root/branches/workshop/FOSS4G2008/Docs/04_openstreetmap.chapter

Revision 241, 4.0 KB (checked in by daniel, 2 years ago)

workshop: osm chapter extended

Line 
1= About OpenStreetMap =
2
3"OpenStreetMap is a project aimed squarely at creating and providing free
4geographic data such as street maps to anyone who wants them."
5"The project was started because most maps you think of as free actually have
6legal or technical restrictions on their use, holding back people from using
7them in creative, productive or unexpected ways."
8[Source: http://wiki.openstreetmap.org/index.php/Press]
9
10OpenStreetMap uses a topological data structure:
11
12 * Nodes are points with a geographic position.
13 * Ways are lists of nodes, representing a polyline or polygon.
14 * Relations are groups of nodes, ways and other relations which can be assigned certain properties.
15 * Tags can be applied to nodes, ways or relations and consist of name=value pairs.
16 
17This is how nodes, ways and relations are described in the OpenStreetmap XML
18file:
19
20{{{           
21<?xml version='1.0' encoding='UTF-8'?>
22<osm version='0.5' generator='JOSM'>
23  ...
24  <node id='252791067' timestamp='2008-03-18T19:45:06+00:00' user='Russell Cloran' visible='true' lat='-33.9291602' lon='18.4251865'>
25    <tag k='created_by' v='JOSM' />
26  </node>
27  <node id='252791066' timestamp='2008-03-18T19:45:05+00:00' user='Russell Cloran' visible='true' lat='-33.9305174' lon='18.4265772'>
28    <tag k='created_by' v='JOSM' />
29  </node>
30  <node id='252791065' timestamp='2008-03-18T19:45:04+00:00' user='Russell Cloran' visible='true' lat='-33.930418' lon='18.4231201'>
31    <tag k='created_by' v='JOSM' />
32  </node>
33  ...
34  <node id='260366643' timestamp='2008-04-28T10:59:11+01:00' user='Adrian Frith' visible='true' lat='-33.9287313' lon='18.415251'>
35    <tag k='created_by' v='JOSM' />
36    <tag k='name' v='South African Museum' />
37    <tag k='tourism' v='museum' />
38  </node>
39  ...
40  <way id='26358722' timestamp='2008-08-17T15:41:55+01:00' user='Adrian Frith' visible='true'>
41    <nd ref='288787699' />
42    <nd ref='288787695' />
43    <tag k='highway' v='residential' />
44    <tag k='name' v='Guinea Fowl Crescent' />
45  </way>
46  <way id='26358723' timestamp='2008-08-17T15:41:56+01:00' user='Adrian Frith' visible='true'>
47    <nd ref='288787696' />
48    <nd ref='288787723' />
49    <nd ref='288787724' />
50    <nd ref='288787728' />
51    <nd ref='288787725' />
52    <nd ref='288787677' />
53    <tag k='highway' v='residential' />
54    <tag k='name' v='Old Farm Road' />
55  </way>
56  ...
57  <relation id='27924' timestamp='2008-08-17T09:53:48+01:00' user='Adrian Frith' visible='true'>
58    <member type='way' ref='4994378' role='outer' />
59    <member type='way' ref='5022484' role='innner' />
60    <tag k='type' v='multipolygon' />
61  </relation>
62  <relation id='22713' timestamp='2008-07-27T22:49:25+01:00' user='Adrian Frith' visible='true'>
63    <member type='way' ref='25817796' role='outer' />
64    <member type='way' ref='25817797' role='inner' />
65    <tag k='type' v='multipolygon' />
66  </relation>
67  ...
68</osm>
69}}}
70
71The OSM data can be downloaded from OpenStreetMap website using an API
72(see http://wiki.openstreetmap.org/index.php/OSM_Protocol_Version_0.5),
73or with some other OSM tools, for example JOSM editor.
74
75Note: The API has a download size limitation, which can make it a bit
76inconvenient to download extensive areas with many features.
77
78When using the osm2pgrouting converter (see later), we take only nodes and ways
79of types and classes specified in "mapconfig.xml" file to be converted to
80pgRouting table format:
81
82{{{
83<?xml version="1.0" encoding="UTF-8"?>
84<configuration>
85  <type name="highway" id="1">
86    <class name="motorway" id="101" />
87    <class name="motorway_link" id="102" />
88    <class name="motorway_junction" id="103" />
89    ...
90    <class name="road" id="100" />
91  </type>   
92  <type name="junction" id="4">
93    <class name="roundabout" id="401" />
94  </type> 
95</configuration> 
96}}}
97
98Detailed description of all possible types and classes can be found here:
99http://wiki.openstreetmap.org/index.php/Map_features.
100
101For Cape Town the OpenStreetMap data is very comprehensive with many details.
102A compilation of the greater Cape Town area created with JOSM is available as
103capetown_20080829.osm.
Note: See TracBrowser for help on using the browser.