Working with OpenStreetMap data

From OpenJUMP Wiki
Revision as of 22:58, 19 August 2013 by Mentaer (talk | contribs) (Created page with '>> return to Documentation ---- by Jukka Rahkonen == Using OpenStreetMap XML data with OpenJUMP == Since August 2013 OpenJUMP Plus version has a native support for opening …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

>> return to Documentation


by Jukka Rahkonen

Using OpenStreetMap XML data with OpenJUMP

Since August 2013 OpenJUMP Plus version has a native support for opening OpenStreetMap XML data. OpenJUMP can open .osm files either as uncompressed or from zip or bzip archive files.

The OpenJUMP OSM driver is using JOSM libraries and therefore the input data must contain the same metadata tags which are needed by JOSM.

OpenJUMP is a Java program which is running totally in memory. Therefore the amount of available memory is limiting how big OSM-XML files can be opened. OpenJUMP needs roughly 2-3 as much memory than the size of the OSM-XML file to be opened. Conversion is quite fast if the OSM dataset is not too big. For example berlin-latest.osm from geofabrik.de (455 MB, 529234 map features) opens in 50 seconds with laptop running 64-bit JRE 1.7.0 (Oracle) on Windows 7 with 8 GB of memory and Intel Core i7 2760QM processor. Sachsen-latest.osm (1.7 GB, 1.52 million map features) takes 3 minutes and 30 seconds with the same computer.

Practical example about reading OSM-XML with OpenJUMP

Acquire a suitable OpenJUMP version

At the moment a development version of OpenJUMP Plus is needed and the revision should be r3662 or higher. Snapshot versions of OpenJUMP can be downloaded from http://sourceforge.net/projects/jump-pilot/files/OpenJUMP_snapshots/

Acquire some OpenStreetMap XML data

Small extracts of OpenStreetMap XML data can be downloaded through the map window of the main OpenStreetMap site http://www.openstreetmap.org

Gettingosmdata.png

It is also possible to use JOSM editor for downloading data and saving osm files on disk. However, for bigger data extracts and for reading filtered data it is recommended to use an API service like OverPASS API http://wiki.openstreetmap.org/wiki/Overpass_API

Advanced features of Overpass API are described in the above mentioned wiki page and in the main site http://www.overpass-api.de/. However, simple queries can be created by using this net application http://harrywood.co.uk/maps/uixapi/xapi.html

Example: Draw a bounding box which covers Finland and create an Overpass API request template.

Osmoverpassexample.png

This request must be edited before it can be used for capturing data for OpenJUMP because OSM driver needs some additional metadata which can be obtained by adding parameter [@meta].

Request for getting all OSM data inside a small bounding box

http://www.overpass-api.de/api/xapi?*[bbox=27,61,27.1,61.1][@meta]

Request for getting all OSM data with tag ”highway_bus_stop” from a box covering whole Finland

http://www.overpass-api.de/api/xapi?*[highway=bus_stop][bbox=19.39087,59.72041,32.39868,70.14596][@meta]

Advanced users can use OSM extracts from Geofabrik and filter data for example with Osmosis or Osmfilter for preparing OSM datasets for OpenJUMP.