- Notifications
You must be signed in to change notification settings - Fork8
mrihtar/SRTM1-Global
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository is a collection of python scripts for parsing and usingSRTM 1 Arc-Second Global (30m) elevation data from USGS/NASA andALOS World 3D-30m (AW3D30) elevation data from © JAXA
.
Withgpxsrtm.py
you can update the elevations in GPX tracks.
SRTM (Shuttle Radar Topography Mission) data is a collection of topographic(elevation) data covering nearly 80 percent of Earth's land surfaces. UntilSeptember 2014 it was globaly available only in 90-meter resolution (SRTM3),but since then a finer 30-meter resolution (SRTM1) is available for thewhole world (JPL Release 2014-321).
Accuracy (90% errors, in meters) | Continent | |||||
---|---|---|---|---|---|---|
Africa | Australia | Eurasia | Islands | N. America | S. America | |
Horizontal | 11.9 | 7.2 | 8.8 | 9.0 | 12.6 | 9.0 |
Absolute Vertical | 5.6 | 6.0 | 6.2 | 8.0 | 9.0 | 6.2 |
Relative Vertical | 9.8 | 4.7 | 8.7 | 6.2 | 7.0 | 5.5 |
Source:SRTM Data Validation and Applications
SRTM 1 Arc-Second Globalvoid filled data (tiles) are available fordownload viaUSGS EarthExplorer web site. To download the data you need toregister first. The SRTM collections are located under the Digital Elevationcategory (see picture at the end).
Because of the availability of finer 30-meter resolution data this set oftools doesn't deal with coarser SRTM3 data.
SRTM1 data downloaded via EarthExlorer is available in three file formats:
- Digital Terrain Elevation Data (DTED) (file size approx. 25 MB/tile)
- Band interleaved by line (BIL) (file size approx. 7 MB/tile)
- Georeferenced Tagged Image File Format (GeoTIFF) (file size approx. 25 MB/tile)
The tools in this repository recognize and readall three formats.
Because of different formats and faster processing of actual tasks thedownloaded data must first be converted to internal Python representation("pickle") with the supplied toolprepare.py
.
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/linearLNDI) and extrapolation (k-NN/12 neighbourscKDT).
Example of preprocessing a tile with voids:
$ prepare.py s17_w068_1arc_v3.dt2Reading s17_w068_1arc_v3.dt2Starting point: 17.0 68.0, size: 3601 x 3601765385 NaN values, interpolatingInterpolating with griddataWriting s17_w068_1arc_v3.pickle
![]() | ![]() |
ALOS World 3D-30m (AW3D30) elevation data is a free 30-meters resolutiondataset obtained by resampling of the 5-meter mesh version of theWorld 3D Topographic Data, which is considered to be the most preciseglobal-scale elevation data at this time.
Current version (v3.2) released in January 2022 is an improved version withall data voids filled. It's available for download atAW3D30 DSM data mapafter registration with e-mail confirmation.
ALOS data downloaded via DSM data map is available inGeoTIFF format only(file size approx. 25 MB/tile). The difference from SRTM data is the rastertype, which isPixelIsPoint in SRTM data andPixelIsArea in ALOS data:
![]() | ![]() |
Because of this the ALOS matrix is 3600 x 3600 and needs to be expanded by onecolumn and line (right and above) from surrounding tiles to be the same sizeas SRTM matrix. This can be done with the supplied toolextpia.py
:
$ extpia.py ALPSMLC30_N046E015_DSM.pickleReading ALPSMLC30_N046E015_DSM.pickleReading ALPSMLC30_N046E016_DSM.pickleReading ALPSMLC30_N047E015_DSM.pickleReading ALPSMLC30_N047E016_DSM.pickleWriting ALPSMLC30_N046E015_EXT.pickle
The resultingALPSMLC30_N046E015_EXT.pickle
is of size 3601 x 3601 and isready to be used for GPX elevation update.
Withgpxsrtm.py
you can update the elevations in GPX tracks.
Example:
$ gpxsrtm.py test-s17_w068.gpxBounding box: -17 -68 (1 SRTM file)Reading data/s17_w068_1arc_v3.pickleWriting test-s17_w068-srtm-bil.gpx
gpxsrtm.py
expects preprocessed SRTM/ALOS data files ("pickles") indata
subdirectory, but you can also specify the location from commandline (see-h
switch):
$ gpxsrtm.py -hUsage: gpxsrtm.py [-h] [-s <source>] [-i <interp>] [-d <datadir>] [-p] <input.gpx> [<input.gpx> ...]Provides elevation for specified geographic coordinatespositional arguments: <input.gpx> Input file(s) in GPX formatoptional 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 calculatingthe elevations between the supplied points from SRTM data files:
- Bilinear interpolation (smoother, default)
- Inverse Distance Weighting (IDW) interpolation
![]() | ![]() |
Additional tools for converting "pickles" to JSON format (and vice versa) areavailable aspickle2json.py
andjson2pickle.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 valuesstart with 0.5 offset on coordinate axes.
You can also print the data matrix as tab separated values withprintdata.py
.