JOSM/Plugins/Elevation

From OpenStreetMap Wiki
Jump to navigation Jump to search

The JOSM plugin Elevation displays terrain elevation at the mouse location on the map and provides an optional elevation visualization layer to display contour lines, hillshade, lowest and highest points in the map view as well as an elevation raster.

In addition, it provides tools to set ele=* of selected nodes, set prominence=* of a natural=peak or natural=hill, determine the topographic isolation of a selected peak or the key col between two selected peaks.

JOSM with Elevation plugin: Overview of features

The plugin is designed to use publicly available elevation data from NASA's Shuttle Radar Topography Mission (SRTM) or Sonny's LiDAR Digital Terrain Models of Europe. It can be configured to automatically download SRTM elevation data from NASA Earthdata as needed. For this, a free NASA Earthdata user account has to be registered.

Configuration

Persistent configuration

  1. From the JOSM menu bar, select Edit -> Preferences.
  2. In the opened preferences dialog, select the tab Elevation Data.
  3. Adapt the configuration to your needs.
  4. Click the OK button at the bottom.
Elevation Data preferences

Configuration options

Option Default Description
SRTM Type SRTM1 The type of SRTM data to use, either SRTM1 or SRTM3.
Elevation Value Interpolation bilinear The type of value interpolation from the SRTM elevation raster data, either bilinear interpolation or none. With bilinear, the elevation value at a map coordinate will be interpolated from the four closest elevation raster values. With none, the elevation value with the raster coordinate which is closest to the map coordinate will be picked.
Max. Size of In-Memory Tile Cache 128 The maximum size (MiB) of the cache storing used SRTM tiles in RAM. By practical considerations, the cache size should be set such that at least four SRTM tiles can be stored in RAM.
Enable Elevation Visualization Layer true Enables a specialized map layer which can display elevation contour lines, hillshade, lowest and highest points in the map view as well as an elevation raster computed from SRTM data.
Layer Rendering Map Size Limit 0.1 Limit value of latitude or longitude (arc degrees) covered by the map view, where, if exceeded, elevation data caching as well as contour line and hillshade rendering will be temporarily switched off to avoid excessive CPU and memory usage.
Contour Line Isostep 10 Step between adjacent elevation contour lines (meters).
Contour Line Stroke Width 1 Width of the stroke used to draw elevation contour lines (px).
Contour Line Color #D2B473 Color of elevation contour lines.
Hillshade Illumination Source Altitude 45 The angle of the hillshade illumination source above the horizon in the range from 0 (horizon) to 90° (overhead).
Hillshade Illumination Source Azimuth 315 (NW) Anglular direction of the hillshade illumination source (N: 0, E: 90°, S: 180°, W: 270°).
Enable Automatic Downloading of Elevation Data false If disabled, elevation in a map area can only be displayed if appropriate SRTM files have been manually downloaded prior to launching JOSM.
Use Password Authentication false Use Earthdata credentials for authorization of SRTM file downloads.
Use Authorization Bearer Token true Use an Earthdata authorization bearer token for authorization of SRTM file downloads.
Earthdata User Name "" Valid Earthdata user name required to authorize automatic downloads if password authentication is selected.
Earthdata Password "" Valid Earthdata password required to authorize automatic downloads if password authentication is selected.
Earthdata Authorization Bearer Token "" Valid Earthdata authorization bearer token required to authorize automatic downloads if this authentication option is selected.

Dynamic, non-persistent configuration

  1. In the JOSM layer manager at the top of the right-hand side pane, select the Elevation Layer.
  2. Right click on the layer manager entry of the Elevation Layer.
  3. From the displayed popup menu, select Dynamic elevation layer adjustment.
  4. In the displayed Elevation Layer Adjustment dialog, adapt the configuration options to your current needs.
  5. Click the Refresh button at the bottom of the dialog.

The changes will immediately take effect. However, the plugin preferences will not be changed.

Configuration options

Option Description
SRTM Type The type of SRTM data to use, either SRTM1 or SRTM3.
Layer Rendering Map Size Limit Limit value of latitude or longitude (arc degrees) covered by the map view, where, if exceeded, elevation data caching as well as contour line and hillshade rendering will be temporarily switched off to avoid excessive CPU and memory usage.
Contour Line Isostep Step between adjacent elevation contour lines (meters).
Upper Cutoff Elevation Greatest elevation value for which to draw contour lines (meters). For greater elevation values, no contour lines will be drawn.
Lower Cutoff Elevation Smallest elevation value for which to draw contour lines (meters). For smaller elevation values, no contour lines will be drawn.
Contour Line Stroke Width Width of the stroke used to draw elevation contour lines (px).
Contour Line Color Color of elevation contour lines.
Illumination Source Altitude The angle of the hillshade illumination source above the horizon in the range from 0 (horizon) to 90° (overhead).
Illumination Source Azimuth Anglular direction of the hillshade illumination source (N: 0, E: 90°, S: 180°, W: 270°).

Note: You can set an isostep of 1 and an upper cutoff value that equals the lower cutoff value to draw contour lines for exactly one isovalue, i.e exactly one elevation value in meters.

Elevation visualization layer

Layer features

The Elevation plugin adds a specialized map layer which can display:

In the layer manager, right click on the elevation visualization layer opens a context menu which allows enabling and disabling the options as desired.

Elevation layer: Elevation visualization options in the layer manager

The layer can be re-added via Imagery -> Add elevation layer.

Info dialog

The elevation layer provides an info dialog with the following pieces of information

  • Dimensions of the current SRTM tile grid, e.g. 4 x 4 SRTM tiles
  • Elevation raster points of the current SRTM tile grid, i.e. the number of non-redundant elevation data points of the current grid's SRTM tiles, e.g. 7601 x 7601 elevation data points
  • Current and maximum size of the SRTM tile cache
  • Information on all SRTM tiles that are currently cached
    • Tile identifier, e.g. N45E009
    • Tile type, SRTM1 or SRTM3
    • Tile status, e.g. valid, downloading, missing
    • Data size of the tile
    • Source of the SRTM tile

Elevation tools

The plugin provides the following elevation tools:

  • Set Node Elevation: Set the ele=* of one or more selected nodes based on the elevation value at the nodes' coordinates, which is obtained from the elevation raster data
  • Set Peak Prominence: Set prominence=* of a natural=peak or natural=hill based on its ele=* and that of a natural=saddle selected along with the peak or hill.
  • Topographic Isolation Finder: Determine the the topographic isolation of a selected peak and optionally add a new OSM data layer with the peak and its isolation reference points
  • Key Col Finder: Determine the key col between two selected peaks and optionally add a new OSM data layer with the peaks and the natural=saddle, which is the lowest col on the highest ridge path connecting the two peaks.

Set node elevation

To make the tool available, go to Edit -> Preferences -> Toolbar, select Set node elevation in the right-hand list of available objects and add it to the left-hand toolbar objects lists by clicking the Add all objects ... button in the middle. The tool will be enabled if at least one OSM data layer is open.

Set peak prominence

To make the tool available, go to Edit -> Preferences -> Toolbar, select Set peak prominence in the right-hand list of available objects and add it to the left-hand toolbar objects lists by clicking the Add all objects ... button in the middle. The tool will be enabled if at least one OSM data layer is open.

Topographic isolation finder

You can open the tool via JOSM's main menu if at least one OSM data layer is open: More tools -> Topographic Isolation Finder

Key col finder

You can open the tool via JOSM's main menu if at least one OSM data layer is open: More tools -> Key Col Finder

SRTM elevation data

General

SRTM elevation data is subdivided into tiles, each covering 1° in longitude and 1° in latitude. The tiles are identified by the latitude and longitude of their south west (lower left) corner.

There are two relevant types of tiles: SRTM1 and SRTM3.

  • SRTM1 tiles contain elevation data sampled at 1 arc-second and have an uncompressed size of about 25 MiB.
  • SRTM3 tiles contain elevation data sampled at 3 arc-seconds and have an uncompressed size of about 3 MiB.

For more detailed information see NASA's SRTM user guide.

Downloading SRTM elevation data

NASA Earthdata

General

SRTM elevation data files provided by NASA Earthdata are compressed and have the extension .hgt.zip. NASA's data covers almost the complete Earth.

  • SRTM1 files can be downloaded from [1].
  • SRTM3 files can be downloaded from [2].

Authorization of downloads

For downloading of files being authorized, NASA requires you to to register an Earthdata user account (free of charge) at Earthdata Login User Registration.

Manual download

Upon manual download of SRTM files, you will be prompted your Earthdata user name and password.

Manually downloaded SRTM files need to be placed in the subdirectory elevation/Earthdata/SRTM1 and elevation/Earthdata/SRTM3 of the JOSM cache directory. Under Linux, the JOSM cache directory should be located at $HOME/.cache/JOSM. It may be necessary to create both subdirectories.

Downloaded SRTM files may not be uncompressed or renamed. Otherwise they will not be recognized by the plugin.

Automatic download

NASA Earthdata Login: Generate Token
NASA Earthdata Login: Applications

To enable automatic download by the Elevation plugin, you can use your Earthdata credentials (user name and password). Alternatively you can use an Earthdata authorization bearer token.

In each case, this information needs to be entered in the Elevation plugin preferences.

If you decide for the authorization bearer token, do the following to generate a token:

  1. Log into your Earthdata user account.
  2. Click on the menu option Generate Token.
  3. Click on the button GENERATE TOKEN.

As soon as the token was generated, click on SHOW TOKEN or the copy to clipboard option to copy the token. Copy the token into the appropriate text field of the Elevation plugin preferences and save it by clicking OK.

The token has an expiration date. Therefore, it will need to be recreated and reentered from time to time. A dialog will be shown if downloading of SRTM data fails due to an authorization error.

Note: It may be necessary to add LP DAAC Data Pool to the list of Approved Applications.

Sonny's LiDAR Digital Terrain Models of Europe

General

Sonny's LiDAR Digital Terrain Models of Europe provides elevation data, which is generally much more accurate than the data provided by NASA Earthdata. However, as the name says, the data only covers Europe. Therefore, Sonny's elevation data is preferred by the plugin over NASA's elevation data, if a matching file of the user-configured SRTM type SRTM1 or SRTM3 is available for the current map view.

SRTM1 compatible DTM1 files can be downloaded from https://drive.google.com/drive/folders/0BxphPoRgwhnoWkRoTFhMbTM3RDA?resourcekey=0-wRe5bWl96pwvQ9tAfI9cQg.

SRTM3 compatible DTM3 files can be downloaded from https://drive.google.com/drive/folders/0BxphPoRgwhnoekRQZUZJT2ZRX2M?resourcekey=0-j5_ZwbdfBp0KnGoFixPm9A.

Manual download

Sonny's elevation data files can only be downloaded manually. However, no user name and password are needed. With the files being stored on Google Drive, it is not possible to derive download URLs from the expected file names. The files can be downloaded individually. Alternatively, the option to download all files in the respective folder as one or more ZIP big archives can be used. This option takes some time to proceed, but is effectively likely faster than downloading the files individually.

Manually downloaded Earthdata SRTM files need to be placed in the subdirectories elevation/Sonny LiDAR/DTM1 and elevation/Sonny LiDAR/DTM3 of the JOSM cache directory. Under Linux, the JOSM cache directory should be located at $HOME/.cache/JOSM. It may be necessary to create the directories.

Source code

The source code can be obtained from JOSM Elevation Plugin on GitHub.