Topography of a region - Python
From wikiluntti
Introduction
An example of Alta-joki Alta river.
https://caltopo.com/map.html#ll=68.8546,23.64807&z=8&b=mbt
Mostly needs an API.
- DEM Digital elevation model
- DSM Digital surface model
- DTM Digital terrain model
Python GIS
- folium
- geopy
- GeoPandas
Earth Model
DEM files (likes SRTM data) with
- Rasterio
- GDAL
Norwegian national DEM (Kartverket). The Norwegian Mapping Authority provides very high-resolution DEM data (down to 1 meter).
Global DEMs (digital elevation model). No need super high resolution. Common datasets:
- SRTM (~30 m resolution)
- ASTER GDEM (~30 m)
Open portals. You can use
- OpenTopography
- OpenDEM
- NASA EarthData
which gives eg GeoTIFF.
Open Topo Data
Open-Elevation.com
Python and GeoTIFF
import rasterio
with rasterio.open("dem.tif") as dem:
for lon, lat in track:
row, col = dem.index(lon, lat)
elevation = dem.read(1)[row, col]
Downsampling the GeoTIFF
from rasterio.enums import Resampling
data = src.read(
out_shape=(
src.count,
src.height // 10,
src.width // 10
),
resampling=Resampling.average
)