mapbox / vector-tile-spec

Mapbox Vector Tile specification
https://www.mapbox.com/vector-tiles/specification/
Other
906 stars 210 forks source link

Numerically equal attribute values are equivalent #124

Open e-n-f opened 6 years ago

e-n-f commented 6 years ago

The spec should be clear that tile encoders may choose any representation (sint, uint, float, or double) for numeric attributes that correctly represents the value, and should choose the one that produces the smallest tile, rather than preserving the type of the original input value, so, for example, 2.0, 2, and 2u will all be represented as the same uint 2.

joto commented 6 years ago

Not sure this is a "should", especially because you might want to keep types consistent between features in the same layer, so if one width property is 2.0 and another is 2.5, you might want them both to be floats, because thats how you use them in the stylesheet or whatever is interpreting your data.

Also conversions back and forth between different numeric types do not necessarily preserve the values.

So I don't think this is something that the spec should get involved in. All the spec guarantees is that if you put a value of a certain type in when creating the tile, it will come out with the same type and same value on the other side. How you encode your values is up to you and it depends on what you expect will read the tiles.