mapbox/tilejson-spec

tiles Property should clearly highlight if relative urls are supported or not.

Danielku15 opened this issue · 1 comments

It appears that the tiles property is not clear enough regarding the support of relative and absolute URLs.
I lately opened a issue on mapbox-gl-js that relative URLs are not correctly handled but the bug was closed with the info that absolute URLs are needed in the tiles property. From the current description it is not 100% clear that his is actually a requirement:

// REQUIRED. An array of tile endpoints. {z}, {x} and {y}, if present,
// are replaced with the corresponding integers. If multiple endpoints are specified, clients
// may use any combination of endpoints. All endpoints MUST return the same
// content for the same URL. The array MUST contain at least one endpoint.
"tiles": [
"http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"
],

It appears that some services like ESRI ArcGIS only specify relative URLs which need to be combined with the URL where the TileJSON is hosted.

Either the spec should mention that only absolute endpoints are supported or it should clearly define how relative URLs should be handled, especially in regards to leading slashes.

Thanks so much for the ticket @Danielku15 👍 . We've added the clarification as part of the upcoming TileJSON 3.0.0 release over at #52.

The main reasoning behind requiring the url to be absolute is because it's ambiguous what a relative URL should be relative to. For example, is it the TileJSON URL, the style URL, or the page URL? What if the TileJSON is inline in the style?

Thanks again for your input.