All Data Structures Files Functions Variables Typedefs Macros Pages
About Open Street Map datasets

Open Street Map aka OSM [http://www.openstreetmap.org/] is a very popular community project aimed to produced a map of the world; this map is absolutely free and is released under the ODbL license terms [http://opendatacommons.org/licenses/odbl/].

Selected portions [by Country / Region] of the OSM map are available on the following download sites:

- http://download.geofabrik.de/
- http://downloads.cloudmade.com/

The best known format used to ship OSM datasets is based on XML; we'll shortly examine the XML general layout so to explain the objects used by the OSM data model and their mutual relationships.

# Node

A Node simply corresponds to a 2D POINT Geometry; the geographic coordinates are always expressed as Longitude and Latitude (corresponding to SRID 4326).
A Node doesn't simply have a geometry; it's usually characterized by several data attributes:

- id: a number uniquely identifying each Node object.
- lon and lat: the geographic Longitude and Latitude of the Point.
- version: a progressive number identifying subsequent versions of the same object.
- changeset: a progressive number identifying a "changeset", i.e. a batch insert/update performed by same user.
- user: nickname of the user committing the changeset.
- uid: a number uniquely identifying the user
- timestemp: commit date-time
- tag-list: any object may eventually be further qualified using arbitrary key:value pairs.

The following is the XML general layout used to represent a Node object:

    <node id="12345" lat="6.66666" lon="7.77777" version="1" changeset="54321" user="some-user" uid="66" timestamp="2005-02-28T17:45:15Z">
            <tag key="created_by" value="JOSM" />
            <tag key="tourism" value="camp_site" />
    </node>

# Way

A Way corresponds to a 2D LINESTRING Geometry: anyway the vertices never are directly defined within the Way itself; a list of indirectly referenced Nodes (<nd ref> items) is required instead.
The data attributes characterizing a Way are more or less the same used for Nodes, and with identical meaning; and for Ways too an arbitrary collection of Tags (key:value pairs) is supported.

The following is the XML general layout used to represent a Way object:

    <way id="12345" version="1" changeset="54321" user="some-user" uid="66" timestamp="2005-02-28T17:45:15Z">
            <nd ref="12345" />
            <nd ref="12346" />
            <nd ref="12347" />
            <tag key="created_by" value="JOSM" />
            <tag key="tourism" value="camp_site" />
    </way>

# Relation

A Relation is a complex object: it can correspond to a 2D POLYGON, or to a 2D MULTILINESTRING, or even to a 2D GEOMETRYCOLLECTION.
A Relation object can reference any other kind of OSM objects: each <member> item can address a Node object, a Way object or another Relation object; the type attribute will always specify the nature of the referenced object, and the optional role attribute may eventually better specify the intended scope.
The data attributes characterizing a Relation are exactly the same used for Ways, and with identical meaning; and for Relations too an arbitrary collection of Tags (key:value pairs) is supported.

The following is the XML general layout used to represent a Relation object:

    <relation id="12345" version="1" changeset="54321" user="some-user" uid="66" timestamp="2005-02-28T17:45:15Z">
            <member type="way" ref="12345" role="outer" />
            <member type="way" ref="12346" role="inner" />
            <tag key="created_by" value="JOSM" />
            <tag key="tourism" value="camp_site" />
    </relation>