Guest User

Untitled

a guest
Jan 16th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. var lat = 50.5524; //Coordinates of Wetzlar, Germany
  2. var lon = 8.5072;
  3. var zoom = 12;
  4. 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
  5. var tileLat = lat2tile(lat, zoom +1);
  6.  
  7. tileLong -> 4289, this is correct as the OSM and the WMTS tile have the same value
  8. tileLat -> 2758, correct in OSM, incorrect for WMTS as WMTS needs inversing the y-axis
  9.  
  10. var invertedTileLat = (1 << zoom) - tileLat - 1; //I have also tried zoom+1
  11.  
  12. invertedTileLat -> 1337, still incorrect for WMTS. The expected result is 897
Add Comment
Please, Sign In to add comment