XML Schema
From OpenStreetMap
The protocol uses this XML Schema for sending and receiving Data. It is also the structure used by planet.osm
Why not GPX is a discussion of the reasoning why our own XML Schema was invented.
FIXME Following sentence is wrong. utils/schema directory no longer exists
There is a XML Schema for the API. It is documented in the SVN repository (see Getting The Source) under utils/schema/osm.xsd. It has been tested against a few examples (also in that directory) and XercesC-2.6. It may, or may not, work with other validators. An example with explanation is shown below.
Please, could someone with time create some links to php-classes that read and write osm (xml) to and from arrays?
Contents |
An example
<osm version="0.4"> <node id="12345" lat="42.0" lon="23.0" timestamp="2006-03-13 14:53:55"/> <node id="15" lat="17.01234" lon="33.6"> <tag k="pub" v="cheap beer" /> </node> <node id="5478" lat="-2.0" lon="123.0" /> ... <way id="678"> <nd id="565" /> <nd id="53123" /> <tag k="name" v="Baker Street" /> </way> ... <node id="5523" lat="23.12" lon="-0.112" /> <area id="688"> <nd id="565" /> <nd id="53123" /> </area> </osm>
The tags
The order of the tags under <osm> are not specified here. They can be dependent on the request For example the history request would probably specify the order as sorted after date.
Node
Nodes are the basic building bricks of the schema. Nodes consist of latitude and longitude. Points of Interests are nodes.
Way
Ways consist of two or more nodes. Streets are ways. Officially designated road names (eg A40) are ways. Basically every linear expressible thing with more than 2 points is a way.
The attributes
timestamp
All objects can have an attribute timestamp, which is the time of the last modification. If it is missing, it is unknown and defaults to the beginning of the universe (which usually is 01/01/1970).
id
Every node with an attribute "id" is an object. Every type of object has its own id namespace. (For historical reasons, hopefully this will change). There can be references to an id, which has not been transfered yet or which will not be transferred at all.
latitude and longitude
Latitude and longitude only appear in the node-tag. Every other reference must point to an object in the nodes list.
And you should know that
This is a general description of how OSM data should be expressed. Some applications may put further restrictions on the data. As example an statistic generator that outputs a list of objects may specify that every object has only the id-tag set, which references the id on the main data server.

