mapbox / mbtiles-spec

specification documents for the MBTiles tileset format
https://www.mapbox.com/help/an-open-platform/#mbtiles
Other
615 stars 99 forks source link

Update vector_layers to match tilejson-spec 3.0 #53

Open mapsam opened 6 years ago

mapsam commented 6 years ago

The TileJSON specification v3.0 will be released soon - this version documents the de factor requirements for vector_layers by adapting the text from 1.3 of this specification.

A key difference is that the TileJSON specification does not require field values to be explicitly Number, String, or Boolean and suggests it should just be a string that describes the attribute. Here is what the mbtiles specification says:

fields (object): A JSON object whose keys and values are the names and types of attributes available in this layer. Each type MUST be the string "Number", "Boolean", or "String". Attributes whose type varies between features SHOULD be listed as "String".

And the tilejson-spec 3.0 proposes the following:

fields (object): A JSON object whose keys and values are the names and descriptions of attributes available in this layer. Each value (description) MUST be a string. The values MAY describe the underlying data type, such as "String", "Number", or "Boolean". Attributes whose type varies between features MAY be listed as "String".

The current mbtiles-spec will continue to be valid once 3.0 is released with this description (since they are strings), but the requirements are unnecessarily strict. In general, the mbtiles-specification is driven by encoders, so the current requirement is likely driven by the inability for computers to put together implicit descriptions other than determining the data type.

Once tilejson-spec is released, can we update the mbtiles-spec to be more relaxed and point to this description of "vector_layers" as the source of truth?

cc @ericfischer @GretaCB @flippmoke

e-n-f commented 6 years ago

Sounds great. The existing description was based on what Mapbox Studio Classic happened to produce, which works, but is more restrictive than it needs to be.