OSM Technical introduction
January 2, 2011
Enrico Zini (enrico@debian.org)
KaLUG Mapping Party, Kaohsiung, January 2, 2011
OSM data types
The while map in OpenStreetMap is built with only 3 kind of elements: * Nodes; * Ways; * Relations.
The structure is simple to understand and to manipulate with software, but it is at the same time very flexible and powerful.
Nodes
Nodes represent one point on the map.
They contain:
- ID: unique among nodes
- Latitude: [-90.0, 90.0], 7 decimal places
- Longitude: [-180.0, 180.0], 7 decimal places
- Tags: zero or more “key: value” pairs
Examples:
- A point of interest
- A part of a way
Ways
Ways are ordered interconnections of 2 to 2000 nodes.
They can be open or closed. Closed nodes can become areas depending on their tags.
They contain:
- ID: unique among ways
- Nodes: list of node IDs
- Tags: zero or more “key: value” pairs
Examples:
- A road
- A park
Relations
Relations are ordered list of 0 or more nodes, ways or relations.
They are used to represent features made of multiple ways, or properties of a group of ways.
Use them rarely and carefully!
They contain:
- ID: unique among roles
- Tags: same as with nodes and ways; most important tag is type
- Members: an ordered list of primitives with associated role (where role may be any text).
Examples:
- Bus routes, cycle routes, numbered highways...
- Multipolygons (e.g. buildings with courtyards inside)
- Routing hints
Extracting data
Some ways to get raw OSM data:
- The API: standard used by most OSM software
- The XAPI: allows more powerful searches
- XML exports: the whole world or some region all in one file
- PBF exports (NEW!): more efficient and faster than XML
Some development tools
Renderers, widgets and databases:
- OpenLayers for the web
- Champlain, a map widget for Gnome
- Memphis a map renderer for Gnome
- OSM GPS Map another map widget for Gtk
- PostGIS allows to perform fast geospatial queries on map data imported in PostgreSQL
- SpatiaLite has the same functions as PostGIS but on a smaller scale
There is a lot of software and libraries available also for Android or iPhone/iPad.
CloudMade offers a very advanced toolset for several platforms but it is not free software.
Development ideas
Licensing
There is a plan for changing the license from CC-By-SA to ODbL.
The new license has the same features as the old one, but it fixes some problems of CC-By-SA when applied to databases.
There is a plan for migration: when you log in to OSM please remember to tell the system if you agree to relicense your data with the new license.
There is also a map that shows what parts of the map has already been agreed for relicensing.