You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess there is a decision here between using a single "metadata" object or a TileJSON compatible spec for sources?
It would also work to write my own custom validation (#3003) but that would probably be overkill just to allow some metadata fields.
I am using this to store metadata that applies to the data itself, like human readable labels and and attribution for the data properties, that would be best stored with the source instead of duplicated in multiple layers. My app assembles and saves maps dynamically so it is easier to save everything in the style object. My hack for the moment is to move the metadata down into the GeoJSON object, but that makes it inconsistent with sources I load from TileJSON. In my case I'm particular interested in documenting the fields, there is some discussion on that in TileJSON here mapbox/tilejson-spec#14
The text was updated successfully, but these errors were encountered:
It seems like we should also be able to add metadata to TileJSON sources and access that from e.g. map.getSource(id).metadata. Unless I'm understanding it wrong, the latest TileJSON spec mentions that if you add keys that aren't part of the TileJSON spec, you should be able to access those. However, mapbox-gl-js strips out all but a few keys.
Implementations MUST treat unknown keys as if they weren't present. However, implementations MUST expose unknown key/values in their API so that API users can optionally handle these keys. Implementations MUST treat invalid values for keys as if they weren't present.
The tiles source type can be extended to add metadata (https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/reference/v8.json#L161), but others like GeoJSON error on validation. Since it is possible to put metadata in layers, and in the root of the style, why not in sources too? :)
I guess there is a decision here between using a single "metadata" object or a TileJSON compatible spec for sources?
It would also work to write my own custom validation (#3003) but that would probably be overkill just to allow some metadata fields.
I am using this to store metadata that applies to the data itself, like human readable labels and and attribution for the data properties, that would be best stored with the source instead of duplicated in multiple layers. My app assembles and saves maps dynamically so it is easier to save everything in the style object. My hack for the moment is to move the metadata down into the GeoJSON object, but that makes it inconsistent with sources I load from TileJSON. In my case I'm particular interested in documenting the fields, there is some discussion on that in TileJSON here mapbox/tilejson-spec#14
The text was updated successfully, but these errors were encountered: