Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lat = 50.5524; //Coordinates of Wetzlar, Germany
- var lon = 8.5072;
- var zoom = 12;
- var tileLong = long2tile (lon, zoom + 1); //For some reason I need to increase the zoom level by 1 to get equivalent results in WMTS and OSM
- var tileLat = lat2tile(lat, zoom +1);
- tileLong -> 4289, this is correct as the OSM and the WMTS tile have the same value
- tileLat -> 2758, correct in OSM, incorrect for WMTS as WMTS needs inversing the y-axis
- var invertedTileLat = (1 << zoom) - tileLat - 1; //I have also tried zoom+1
- invertedTileLat -> 1337, still incorrect for WMTS. The expected result is 897
Add Comment
Please, Sign In to add comment