Repository navigation
support 'tms' tile scheme - #2565
Conversation
|
What do you think about supporting |
|
@mourner I suggested that in #2409; |
|
Oh, you're totally right — I wasn't aware it's in the TileJSON specs. Looks good to me then! |
|
@indus completely forgot to ask — can you PR a simple unit test for this change? |
|
@lucaswoj Thanks for doing the hard work! |
|
please note that the style spec only mentions scheme for raster sources, not for vector sources. Is this an omission in the style spec? https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-raster |
|
Did you really came across Vector Tiles with TMS scheme? But you are right it says in the specs:
(of course it says nothing about the support for it ;-) |
TMS is the scheme used in mbtiles, so it's not that unthinkable... |
|
Thanks for supporting TMS as OGC config vector tiles format, and make it configurable in Mapbox-gl-js. Do you think about elaborating it in official documentation? A lot of developers are relying on the documentation. For example, since this support is not elaborated, the type library of Mapbox-gl-js in angular lacks TMS support in vector tiles. |
|
@eugeneYWang I just opened a PR adding this to the docs #6847 |
| .replace('{z}', Math.min(this.z, sourceMaxZoom || this.z)) | ||
| .replace('{x}', this.x) | ||
| .replace('{y}', this.y); | ||
| .replace('{y}', scheme === 'tms' ? (Math.pow(2, this.z) - this.y - 1) : this.y); |
There was a problem hiding this comment.
Hi, I'm using mbtiles, but i find the tool i used to translate google xyz to tms schema does not use Math.pow(2, this.z) - this.y - 1, but Math.pow(2, this.z - 1) - this.y - 1. I konw that tms's original is (-180, -90), and xyz's original is (-180, 90), so it is easy to understand Math.pow(2, this.z - 1) - this.y - 1.
Can somebody tell me how does Math.pow(2, this.z) - this.y - 1 works and which is right method?
There was a problem hiding this comment.
Can you provide a link to the tool you are using?
With quick websearch I only found the transformation in use:
https://gist.github.com/tmcw/4954720
http://bl.ocks.org/lennepkade/b6fe9e4862668b2d19fe26f6c2d7cbef
https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/
There was a problem hiding this comment.
I've red the 3rd blog and learned that i misunderstood the map tile method. So we transfer the world to a square using Web Mercator system, and we can get the total tile number which can be described as (1 << zoom - 1).
Now I guess it is the coordinate system i'm using cause the problem. In fact, i transformed a map to mbtiles which is projected to EPSG:4326 (WGS84) . But as we know mbtiles spec using tms and mercator projection. That might need to be supported by a projection-customized mapbox-gl.
Thanks for your help! :) 👍
Issue: #1616
Specs: https://www.mapbox.com/mapbox-gl-style-spec/#sources
Reference: https://github.com/mapbox/tilejson-spec/blob/master/2.1.0/schema.json#L28
(a new clean attempt for #2480)