This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Calculate tile from latitude and longitude

0

I'm trying to determine how the "TILE" field in the current_nodes table is calculated based off of the latitude and longitude.

I've seen the slippy map tile names and understand the concept of xtile vs. ytile. But I am failing to see the correlation between xtile, ytile, and the TILE value as seen in the current_nodes table. I've seen a write up on Bing about how Bing makes the conversion, and it seems similar, but not exact to what OSM is doing. Any ideas?

As an example, using the following latitude and longitude, you should get the following:
Lat: 52.5164839
Lng: 13.3817427
Tile: 3502687520

asked 11 Dec '14, 07:19

jhilll's gravatar image

jhilll
16113
accept rate: 0%

edited 11 Dec '14, 07:22


One Answer:

3

The "tile" column in the current_nodes table has nothing to do with map tiles. See https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/quad_tile/quad_tile.h for how to compute the value.

answered 11 Dec '14, 09:02

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Source code available on GitHub .