SRTM Plugin for OpenStreetMap's Osmosis
Data nodes from OpenStreetMap are defined by id, latitude and longitude (plus additional attributes), which is enough for painting 2D maps and standard routing queries. Modern routing algorithms for example can also take advantage of elevation data (If for example fuel costs should be taken into account).
As the elevation is not added to OpenStreetMap data directly, there plugins are needed that make use of Nasa SRTM data to obtain the elevation information. This osmosis-srtm-plugin is intended to be used as a plugin for Osmosis to process OSM-input files together with SRTM data in order to add a height tag to each node.
The plugin works out-of-the-box but provides configurable settings to satisfy hopefully all requirements
- Running the plugin in Osmosis 0.46 will throw error messages, but still provide the correct output.
- Files must be downloaded manually from the USGS website.
- v1.1.1: moved into suitable package hierarchy - v1.1.0: added possibility to define the tag name (Issue 3) - v1.0.1: compatibility fix with newer osmosis-versions - v1.0.0: first release
- Download and unpack Osmosis latest.
- Check that
plexus-classworlds-2.4.jarIf it carries another version number, you possibly have to adjust
- Clone and build the repo or download the binary from Bintray.
bin\pluginsand put the build/downloaded jar there (if this doesn't work, try
- create a
osmosis-plugins.confin the config-folder containing the following line
- Download your desired SRTM files from the USGS website.
- Place those files in a folder, making sure each remains as .hgt.zip files.
Get an OSM file (for example via export from OpenStreetmap.org) and try it:
osmosis.bat --read-xml ... --write-srtm <your args> --write-xml ...
Afterwards enjoy your osm file with added srtm height tags.
Make sure you set the locDir param to the location of your SRTM files
Restrictions / SRTM Formats
The plugin currently supports only SRTM3 files created by the NGA and reprocessed to Version 2.1 (http://dds.cr.usgs.gov/srtm/What_are_these.pdf), but any other SRTM files with the same binary format should be usable, too. Therefore it is not recommend to overwrite the default values for srvBase and srvSubDirs.
locDir= Local directory for download and storage of SRTM files (default: temp-directory)
srvBase= Base URL of SRTM server (default: have a look at the
srtmservers.propertiesinside the jar)
srvSubDirs= Subdirectories of SRTM server, where to look for the SRTM files (.hgt), separeted by semicolons (default: have a look at the
srtmservers.propertiesinside the jar)
locOnly= Prohibit the download of new SRTM files and try to use the files available at locDir (default: false)
repExisting= Replace all existing height tags of nodes (default: true)
tagName= The tag name used for the elevation data. (default: height due to historical reasons. Yet, the ele tag should be used according to Openstreetmap)
osmosis.bat --read-xml test.osm --write-srtm <additional commands> --write-xml test_with_srtm.osm
Result The SRTMPlugin uses the default values of all commands.
osmosis.bat --read-xml test.osm --write-srtm locDir=C:\Users\Test\Desktop\SRTM locOnly=true repExisting=false --write-xml test_with_srtm.osm
locDir=C:\Users\Test\Desktop\SRTMlocal directory for all SRTM files
locOnly=trueforces the plugin to work only with already existing SRTM files inside the locDir directory
repExisting=falsedoes not allow the replacement of nodes already tagged with some kind of height information
osmosis.bat --read-xml test.osm --write-srtm srvBase=http://any.srtm.server.url.here srvSubDirs=America;Africa;Eurasia;Australia --write-xml test_with_srtm.osm
srvBase=http://any.srtm.server.url.hereas base URL for any available SRTM server
srvSubDirs=America;Africa;Eurasia;Australiaforces the plugin to look only in the subdirectories of America, Africa, Eurasia and Australia for matching SRTM files while all other subdirectories are being ignored