-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Allow getting the original TileJSON #2965
Comments
(This issue has also been reported as mapbox/mapbox-gl-js#5471.) |
I generally think the workaround is OK if this is what you need, but I'm open to hear what other options can solve this in maplibre (i.e. a design) from your perspective. |
The workaround is limited in utility. Some examples:
|
This behavior dates to 43df2ac. Unfortunately there doesn’t seem to be any public discussion as to why this commit switched from including all the TileJSON properties to only including a few that GL JS used directly. As far as an API design, the TileJSON specification doesn’t say exactly how to expose the unrecognized properties; it only requires that they be exposed somehow. Since MapLibre now uses TypeScript, I suppose the freeform approach of just dumping these properties into the source object would be problematic. But perhaps |
That feels like it would be unnecessarily brittle? This object contains all the properties we don't support, until maybe one day whoops, we decide that |
I was just thinking about how to keep the |
User Story
As a map developer, I can access the TileJSON data from the source's URL, so that I can use all the metadata.
Rationale
The specification says so:
Apart from that, there are a variety of reasons this is useful, many sources include the replication timestamp of the source material, tippecanoe includes the command line arguments and statistical information, and so on. A control could look for a particular key value pair and put the planet date in the corner of the map. And so on.
It appears that the current implementation copies the fields it likes out of the TileJSON and discards the rest. It would probably make sense to save the raw TileJSON object for later retrieval, rather than trying to extend this logic to avoid clobbering the Source object with arbitrary keys.
Impact
As a workaround, a developer could fetch the TileJSON separately from the tile source doing so, which might be inefficient and less generalizable.
The text was updated successfully, but these errors were encountered: