OJW's tile data server
This article or section may contain out-of-date information. The information is no longer correct, or no longer has relevance.|
If you know about the current state of affairs, please help keep everyone informed by updating this information. (Discussion)
This is an implementation of a cacheable Tile data server, the OSM data is transformed a bit:
- Ways contains the node coordinates, allowing ways to render without fetching nodes.
- Ways still contains node IDs, so you can spot connected ways.
- Coordinates are projected into slippy-map tile coordinates, to make tile-rendering faster
Get nodes within a tile
Get ways within a tile
Get way by ID
Get map of a tile
this is the main aim of the tileserver - everything else is ancillary
What are x and y
x and y are (1/231)th of the width or height of the tile map
you want more explanation?
OK, imagine you've multiplied them by 1/(2^31), so you've got values from 0 to 1.
in X, 0 is 180 degrees west, and 1 is 180 degrees east. This is completely linear, so you can just multiply X by 360 and remove 180 to get degrees (WGS84)
in Y, 0 is the top of the map at 85.0511 north, and 1 is the similar number of degrees south. This is in the mercator projection, so don't try converting it to degrees without using the inverse of that famous log(tan + sec) equation
See Slippy map tilenames for the gory details, and sample implementations in 13 languages
y = (1 - log(tan(lat) + sec(lat)) / π) / 2
where lat is in degrees, and y is the 0-1 value mentioned above. Reverse this equation to convert y to lat.
This API is designed to be cacheable. While the API in itself isn't much different from the real API, the difference is that with this one you expect many different people to be requesting the same (or similar) URLs with the same result.
Therefore, if anyone wants to setup a reverse cache thingy in front of the website, it might be very useful.
These are all simple, just haven't been added to the server code or data yet:
- tagged nodes
- ways which cross the tile but don't contain any nodes within the tile
- UK only
- 2008-05-21 data only
- query at more than zoom-15(all files are static)
- Way-simplifying as you request lower zoom levels
obviously the big push for this type of server is to do on-demand rendering (where you don't need to specify new map layers a year in advance, or need one server per map layer) e.g. see pyrender idea
but another use might be the routing, where you just keep loading new tiles as your route moves between areas, rather than needing to load everything at the beginning.
The code can be downloaded from OSM SVN repository
svn co https://svn.openstreetmap.org/applications/utils/export/tiledata/import