OJW's tile data server
If you know about the current state of affairs, please help keep everyone informed by updating this information. (Discussion)
Introduction
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
API
Get nodes within a tile
https://dev.openstreetmap.org/~ojw/api/?/nodes_in/15/17139/11093
Get ways within a tile
https://dev.openstreetmap.org/~ojw/api/?/ways_in/15/16218/10741
Get way by ID
https://dev.openstreetmap.org/~ojw/api/?/way/35
Get map of a tile
https://dev.openstreetmap.org/~ojw/api/?/map/15/16218/10741
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.
Right:
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
even more?
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.
Caching
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.
Limitations
These are all simple, just haven't been added to the server code or data yet:
- tagged nodes
- relations
- ways which cross the tile but don't contain any nodes within the tile
- UK only
- 2008-05-21 data only
TODO
- query at more than zoom-15(all files are static)
- Way-simplifying as you request lower zoom levels
Motivations
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.
Code
The code can be downloaded from OSM SVN repository
svn co https://svn.openstreetmap.org/applications/utils/export/tiledata/import
Strategy
Database
https://dev.openstreetmap.org/~ojw/files/TileDataServer/schema.txt
Status (data)
Coverage | Planet |
---|---|
Date | 2008-06-11 |
Data | Ways |