Skip to content

Tools for parsing and using USGS SRTM 1 Arc-Second Global (30m) and ALOS World 3D-30m (AW3D30) elevation data

Notifications You must be signed in to change notification settings

openstreetmap-si/SRTM1-Global

 
 

Repository files navigation

SRTM1-Global and AW3D30

This repository is a collection of python scripts for parsing and using SRTM 1 Arc-Second Global (30m) elevation data from USGS/NASA and ALOS World 3D-30m (AW3D30) elevation data from © JAXA .

With gpxsrtm.py you can update the elevations in GPX tracks.

About SRTM1 data

SRTM (Shuttle Radar Topography Mission) data is a collection of topographic (elevation) data covering nearly 80 percent of Earth's land surfaces. Until September 2014 it was globaly available only in 90-meter resolution (SRTM3), but since then a finer 30-meter resolution (SRTM1) is available for the whole world (JPL Release 2014-321).

Accuracy
(90% errors, in meters)
Continent
AfricaAustraliaEurasiaIslandsN. AmericaS. America
Horizontal 11.97.28.89.012.69.0
Absolute Vertical 5.66.06.28.0 9.06.2
Relative Vertical 9.84.78.76.2 7.05.5

Source: SRTM Data Validation and Applications

SRTM 1 Arc-Second Global void filled data (tiles) are available for download via USGS EarthExplorer web site. To download the data you need to register first. The SRTM collections are located under the Digital Elevation category (see picture at the end).

Because of the availability of finer 30-meter resolution data this set of tools doesn't deal with coarser SRTM3 data.

✋   NOTE: To use the tools you have to download the data yourself!

SRTM1 data downloaded via EarthExlorer is available in three file formats:

  1. Digital Terrain Elevation Data (DTED) (file size approx. 25 MB/tile)
  2. Band interleaved by line (BIL) (file size approx. 7 MB/tile)
  3. Georeferenced Tagged Image File Format (GeoTIFF) (file size approx. 25 MB/tile)

The tools in this repository recognize and read all three formats.

Because of different formats and faster processing of actual tasks the downloaded data must first be converted to internal Python representation ("pickle") with the supplied tool prepare.py.

Interpolation

Preprocessing of data also takes care of possible voids detected in data (yes, some tiles may still contain voids!) with the built-in interpolation (griddata/linear LNDI) and extrapolation (k-NN/12 neighbours cKDT).

Example of preprocessing a tile with voids:

$ prepare.py s17_w068_1arc_v3.dt2
Reading s17_w068_1arc_v3.dt2
Starting point: 17.0 68.0, size: 3601 x 3601
765385 NaN values, interpolating
Interpolating with griddata
Writing s17_w068_1arc_v3.pickle

About ALOS data

ALOS World 3D-30m (AW3D30) elevation data is a free 30-meters resolution dataset obtained by resampling of the 5-meter mesh version of the World 3D Topographic Data, which is considered to be the most precise global-scale elevation data at this time.

Current version (v3.2) released in January 2022 is an improved version with all data voids filled. It's available for download at AW3D30 DSM data map after registration with e-mail confirmation.

ALOS data downloaded via DSM data map is available in GeoTIFF format only (file size approx. 25 MB/tile). The difference from SRTM data is the raster type, which is PixelIsPoint in SRTM data and PixelIsArea in ALOS data:

Because of this the ALOS matrix is 3600 x 3600 and needs to be expanded by one column and line (right and above) from surrounding tiles to be the same size as SRTM matrix. This can be done with the supplied tool extpia.py:

$ extpia.py ALPSMLC30_N046E015_DSM.pickle
Reading ALPSMLC30_N046E015_DSM.pickle
Reading ALPSMLC30_N046E016_DSM.pickle
Reading ALPSMLC30_N047E015_DSM.pickle
Reading ALPSMLC30_N047E016_DSM.pickle
Writing ALPSMLC30_N046E015_EXT.pickle

The resulting ALPSMLC30_N046E015_EXT.pickle is of size 3601 x 3601 and is ready to be used for GPX elevation update.

GPX elevation update

With gpxsrtm.py you can update the elevations in GPX tracks.

Example:

$ gpxsrtm.py test-s17_w068.gpx
Bounding box: -17 -68 (1 SRTM file)
Reading data/s17_w068_1arc_v3.pickle
Writing test-s17_w068-srtm-bil.gpx

gpxsrtm.py expects preprocessed SRTM/ALOS data files ("pickles") in data subdirectory, but you can also specify the location from command line (see -h switch):

$ gpxsrtm.py -h
Usage: gpxsrtm.py [-h] [-s <source>] [-i <interp>] [-d <datadir>] [-p]
                  <input.gpx> [<input.gpx> ...]

Provides elevation for specified geographic coordinates

positional arguments:
  <input.gpx>   Input file(s) in GPX format

optional arguments:
  -h, --help    show this help message and exit
  -s <source>   Data source: srtm or alos (default: srtm)
  -i <interp>   Interpolation type: bilinear or idw (default: bilinear)
  -d <datadir>  SRTM/ALOS data directory (default: <prog>\data)
  -p            Plot read SRTM/ALOS data (default: False)

This tool uses the following interpolations (selectable) for calculating the elevations between the supplied points from SRTM data files:

  1. Bilinear interpolation (smoother, default)
  2. Inverse Distance Weighting (IDW) interpolation

Transportability

Additional tools for converting "pickles" to JSON format (and vice versa) are available as pickle2json.py and json2pickle.py. The preprocessed data is a matrix of size 3601 x 3601 with the (0, 0) coordinates in lower left corner with no void/NaN values. ALOS data values start with 0.5 offset on coordinate axes.

You can also print the data matrix as tab separated values with printdata.py.

USGS EarthExplorer SRTM1 global data selection

About

Tools for parsing and using USGS SRTM 1 Arc-Second Global (30m) and ALOS World 3D-30m (AW3D30) elevation data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%