-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complex Properties Overhaul #121
Closed
Closed
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7217923
Example complex value setup to perhaps increase compression of proper…
flippmoke fe9139a
Small fixes to properties wording
flippmoke 736b0ec
Fix wording yet again
flippmoke 5f954d6
4 bits are needed for value types. Use sint64 instead of int64.
e-n-f 66e465c
Correct grammar
flippmoke 5bd6daa
Change tables of integers by reference to be fixed-size
e-n-f d5d96e5
Merge branch 'blake_properties' of github.com:mapbox/vector-tile-spec…
e-n-f af1d5d9
Reword and reorder for consistency. Add separate attribute pool message.
e-n-f 3f262a4
Be clear about undefined types 10 through 15
e-n-f 522bca8
Be clear that the count for a map refers to the number of pairs
e-n-f 001e3ed
Revise to match https://github.com/mapbox/vector-tile-spec/pull/123
e-n-f 2f95642
Move string values back to the top level of the layer
e-n-f File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,11 @@ message Tile { | |
message Feature { | ||
optional uint64 id = 1 [ default = 0 ]; | ||
|
||
// Tags of this feature are encoded as repeated pairs of | ||
// Attributes of this feature are encoded as repeated pairs of | ||
// integers. | ||
// A detailed description of tags is located in sections | ||
// A detailed description of attributes is located in sections | ||
// 4.2 and 4.4 of the specification | ||
repeated uint32 tags = 2 [ packed = true ]; | ||
repeated uint32 attributes = 2 [ packed = true ]; | ||
|
||
// The type of geometry stored in this feature. | ||
optional GeomType type = 3 [ default = UNKNOWN ]; | ||
|
@@ -44,6 +44,63 @@ message Tile { | |
// A detailed description on geometry encoding is located in | ||
// section 4.3 of the specification. | ||
repeated uint32 geometry = 4 [ packed = true ]; | ||
|
||
// Additional attributes (or all the attributes) of this feature may be | ||
// encoded as repeated pairs of 64-bit integers, to take | ||
// advantage of inline encoding of small values, | ||
// improved compression from use of repeated values, | ||
// and support for list and map values. | ||
// | ||
// This message may only be used if the layer version is >= 3. | ||
// | ||
// The inline_attributes field is much like the attributes field in that it is a pair of | ||
// integers that reference key and value pairs. However, the value reference | ||
// is a "complex_value" that combines a type and an index. | ||
// | ||
// The "key_index" is much like the key index in the use for attributes, but instead | ||
// of pointing into layer.keys, it points into layer.attribute_pool.keys. | ||
// | ||
// An complex value has two parts: the lowest 4 bits are the type bits, | ||
// and the remaining bits are the parameter bits. What is stored in the parameter | ||
// bits is dependent on the contents of the type bits. For example for inline values, | ||
// the parameter field is not an index but simply a value. For other types it is | ||
// an index position into a value storage of the layer. | ||
// | ||
// uint64_t type = complex_value & 0x0F; // Bottom 4 bits | ||
// uint64_t parameter = complex_value >> 4; | ||
// | ||
// Type | Id | Parameter | ||
// --------------------------------- | ||
// string | 0 | index into layer.attribute_pool.string_values | ||
// float | 1 | index into layer.attribute_pool.float_values | ||
// double | 2 | index into layer.attribute_pool.double_values | ||
// int | 3 | index into layer.attribute_pool.signed_integer_values | ||
// uint | 4 | index into layer.attribute_pool.unsigned_integer_values | ||
// inline uint | 5 | value of unsigned integer (values between 0 to 2^60-1) | ||
// inline sint | 6 | value of zigzag-encoded integer (values between -2^59 to 2^59-1) | ||
// bool/null | 7 | value of 0 = false, 1 = true, 2 = null | ||
// list | 8 | value is the number of sub-attributes to follow: | ||
// | | each item in the list is a complex value | ||
// map | 9 | value is the number of pairs of sub-attributes to follow: | ||
// | | each pair is an index into layer.attribute_pool.keys | ||
// | | followed by a complex_value for the value | ||
// | ||
// Value types 10 through 15 are reserved for definition in future versions | ||
// of this specification. Implementations MUST treat complex_values of these | ||
// types as opaque values that are not followed by additional sub-attributes. | ||
// In the future they may refer to additional inline types or additional | ||
// reference types. | ||
repeated uint64 inline_attributes = 5 [ packed = true ]; | ||
} | ||
|
||
message AttributePool { | ||
repeated string keys = 1; | ||
|
||
repeated string string_values = 2; | ||
repeated float float_values = 3 [ packed = true ]; | ||
repeated double double_values = 4 [ packed = true ]; | ||
repeated sfixed64 signed_integer_values = 5 [ packed = true ]; | ||
repeated fixed64 unsigned_integer_values = 6 [ packed = true ]; | ||
} | ||
|
||
// Layers are described in section 4.1 of the specification | ||
|
@@ -69,6 +126,8 @@ message Tile { | |
// See https://github.com/mapbox/vector-tile-spec/issues/47 | ||
optional uint32 extent = 5 [ default = 4096 ]; | ||
|
||
optional AttributePool attribute_pool = 7; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest these should get "logical" names like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also fine with me. |
||
extensions 16 to max; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should change this to be 2^56 for uint and 2^55 for signed due to the way varints are encoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to differentiate between what encodings are possible and what encodings are recommended. The spec may well say that this or that encoding is recommended becaus it is usually better, but still require readers to understand a different encoding.