Networks/Import/OpenStreetMapDownload

From http://www.openstreetmap.org/: "OpenStreetMap is a free editable map of the whole world. It is made by people like you."

"OpenStreetMap creates and provides free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive, or unexpected ways."

The amount of data contained within OpenStreetMap, and their quality, is really amazing. Even though no demand data is available, the quality of the road networks makes it worth to regard OpenStreetMap as a data source for traffic simulations, especially if one is interested in multi- or inter-modal simulations.

This page describes how OpenStreetMap data can be obtained. OSM data must be converted before it can be used with Sumo (see Networks/Import/OpenStreetMap). The page OpenStreetMap file gives further general information on the data format.

=OpenStreetMap API= OSM-data can be downloaded using a web browser or preferably with a program such as wget. For detailed information refer to the API overview

=Downloading a City= Modelling a single city is a common simulation use case. OSM Overpass API provides a comfortable interface to obtain the road network and infrastructure within a city boundry (or other administrative region).

This is two step Process: First you must obtain the Id (Identification Number) of the area you want to download. Then you can use that Id to download the area.

Obtaining an area Id
Copy the following query into the input box on the the OSM Overpass API query page. Replace Berlin by the city name of your choice and click the accompanying button "Explore".

 

This will prompt you to download or open a file containing the answer to your query.

 ...               <tag k="tiger:PLCIDFP" v="1307304"/> <tag k="wikipedia" v="Berlin,_Georgia"/> <tag k="type" v="multipolygon"/> <tag k="boundary" v="administrative"/> <tag k="admin_level" v="8"/> <tag k="name" v="Berlin"/> <tag k="border_type" v="city"/> <tag k="created_by" v="polyshp2osm-multipoly"/> <tag k="source" v="TIGER/Line® 2008 Place Shapefiles (http://www.census.gov/geo/www/tiger/)"/> <tag k="tiger:reviewed" v="no"/> <tag k="is_in:country" v="USA"/> ...

The important parts of result data are the  elements. This  attribute will be used to download the OSM-data for your chosen city.

Important: as in the Berlin-query above, there may be multiple results. Usually the accompanying tags will be sufficiently helpful to distinguish between Berlin,Germany and Berlin,USA/Georgia. If the output does not contain the region you were looking for, it might be helpful to add the type of region e.g. Berlin, city. If problems persist read on at the OSM Overpass API site.

Downloading an area by Id
The Id obtained in the previous step for the city of Berlin was 62422. Technically this is only the Id of the border of Berlin and we must add the number 3,600,000,000 to obtain the Id of the area of berlin.

Using this number we construct another query for an input box on the OSM Overpass API qery page.

<osm-script timeout="180" element-limit="20000000"> <area-query ref="3600062422"/> <recurse type="node-relation" into="rels"/> <recurse type="node-way"/> <recurse type="way-relation"/> <recurse type="way-node"/> </osm-script>

Replace the number for the  by the number from above and click the accompanying button "Download". This will prompt you to download or open a file containing the OSM-data for your city.

Important: For large cities you may have to adapt the values for  and.

=Downloading a Rectangular Area=

The Java OpenStreetMap Editor (JOSM) is a mature tool for handling OSM-data. It allows for comfortable downloading of rectangular areas using an interactive map. It even supports searching for an area by name (i.e. Berlin).

=Downloading a Rectangular Area Using the command line=

Downloading OSM-data via the command line is a two step process: First you must determine the geo-coordinates for your area. Then you can download OSM-data using those coordinates

Obtain the geo-coordinates
You need the (longitude, latitude)-numbers for the south-west corner and for the north-east corner of your chosen area. You can get them at this page by pointing your mouse at the appropriate map location and observing the coordinates in the status bar. The inner city of Berlin lies within the following coordinates:

Download the area
Construct an URI (web adress) from the geo-coordinates and download the data from that URI. The URI takes the following form:

for the above example this becomes

you can download your data by entering the URI in a web-browers or by using another program such as wget.

Important: the API version number 0.6 will eventually be outdated. Refer to the openstreetmap API page for the latest version..

Downloading a large area
The OpenStreetMap-API limit the size of an area to extract. The help script osmGet.py located within /tools/import/osm allows to extract a larger area by splitting the requests. The call is:

osmGet.py <PREFIX> <BOUNDING_BOX> <TILES_NUMBER>

The bounding box must be given as <LAT_MIN>,<LONG_MIN>,<LAT_MAX>,<LONG_MAX>.

This script will extract OSM-data as n files with n =<TILES_NUMBER>, named "<PREFIX><INDEX>_<TILES_NUMBER>.osm.xml". These files can be imported by the scripts osmBuild.Py and osmBuildPolys.py, also located in /tools/import/osm. This is described in Networks/Import/OpenStreetMap.