Google Summer of Code/2012/Data Tile Service

From OpenStreetMap Wiki
Jump to navigation Jump to search

The goal of this project is to make OSM data accessible as tiles, similar to map image tiles. The implementation will be both a publicly accessible data tile service and an application which users can set up on their own servers that can be configured to produce customized data tile sets.

Customizations will include things like:

  • Filtering map elements by tag
  • Filtering the tags which appear on elements
  • Simplifying geometry
  • Combining elements
  • Different subsets of data available at different zoom levels

The basic architecture of the service will feature a replica of OSM data in an SQL database (with GIS extensions) kept up to date with diffs. As diffs are applied, affected tiles will be regenerated by querying the database. Tiles will be written to disk or optionally uploaded to a server for hosting.



Week Milestones
Week 1
  • Collect community feedback about data tile format, customization options, additional use cases, etc. Solicit testers.
  • Specify how customization options and architecture will work.
Week 2
  • Produce and update a data tile set with a geographical subset and certain types of point of interest. (Tiles not publicly hosted.)
Week 3
  • Produce and make available a static data tile set with a fixed geographical subset of map data (at the scale of a city -- possibly SF bay area?). The tile set will have one zoom level and the tiles will include all data that would be returned by a "map" call to the OSM API for the corresponding bbox.
Week 4
  • Provide continuously updated tiles for the fixed geographical subset. (Update with minute diffs.)
Weeks 5-7
  • Implement customization options, including filtering elements by tag, tag filtering, geometry simplification, feature combination.
Week 8
  • Midterm goal: provide a data tile subset for the entire planet with usage demo. One possibility is the "editor" data tile set with a range of zoom levels, simplified geometry, combined features, and with ids and versions of map elements only (no tags).
Weeks 9-11
  • Work with testers to ensure that various use cases, such as client-side rendering and clickable points of interest, can be supported properly. Provide demos where possible.
Week 12
  • Complete documentation, including detailed setup instructions. (Work on this throughout the project with input from testers.)
  • Complete demos.
  • Complete setup of publicly available data tile sets, as determined by feedback and usage.

Use cases

Client-side map rendering

  • Requires small file sizes, but with enough information to draw the map
  • Different subsets of data at different zoom levels -- and different levels of detail for ways, etc. at different zoom levels
  • Must deal with coastlines


  • Want to support a similar interface as Potlatch, where editable features are displayed as vector shapes, and are clickable
  • Could include only geometry, ids, and versions of editable features -- tags could be loaded from the API once a user selects a feature
  • Geometry can be simplified, and nodes can be combined -- a given map feature in this tile set could possibly refer to multiple nodes (at lower zoom levels)
  • Fewer features available for editing at lower zoom levels -- for example, click on a city to edit population figures

Client-side interactivity, such as clickable points of interest

  • Layer over image tiles
  • Clickable points of interest -- show opening hours for a shop, etc.
  • Subset based on tags

Tile format

File size is a major constraint. Use cases discussed above are mostly for web browsers, so json makes sense (easy to parse, concise). json or jsonp? configurable?

Similar to kothic js tile format -- like geojson, with modifications to make file sizes smaller

  • positions inside tile are given as offsets from a corner
  • could also shorten property names (ie "coordinates" -> "c")
  • should be easy to convert to proper GeoJSON for use with Leaflet, etc.

Source Code

(Added by Graham Jones while I am trying to get it working - Michael may correct my mistakes for me!) Source code stored at [1]

To get it to run on Ubuntu Linux you need to do:

  • sudo apt-get install ruby rubygems
  • sudo gem install pg
  • sudo gem install sinatra
  • sudo gem install json

Note you get some errors about not being able to install documentation, but the code seems to install...

You can then run script/render --tile 10/1/1