SRTM / Terrain

Daisho.terrain_heightFunction
terrain_height(tile_directory::String, latitude::Float64, longitude::Float64) -> Float64

Look up terrain elevation at a single geographic point from SRTM tiles stored on disk.

Loads the appropriate SRTM tile from the specified directory and returns the elevation. Returns -1.0 if no elevation data is available (e.g., over ocean) or if an error occurs.

Arguments

  • tile_directory::String: Path to directory containing SRTM .hgt tile files.
  • latitude::Float64: Latitude in decimal degrees (positive north).
  • longitude::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters, or -1.0 if data is unavailable or an error occurs.
source
terrain_height(tiles::Dict{String, Raster}, latitude::Float64, longitude::Float64) -> Float64

Look up terrain elevation at a single geographic point using a pre-loaded dictionary of SRTM raster tiles.

This method avoids repeated disk I/O by using tiles already loaded into memory via read_srtm_elevation_multi(tile_directory). Returns -1.0 if no elevation data is available or if an error occurs.

Arguments

  • tiles::Dict{String, Raster}: Dictionary mapping tile name strings (e.g., "N16W025") to loaded Raster objects.
  • latitude::Float64: Latitude in decimal degrees (positive north).
  • longitude::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters, or -1.0 if data is unavailable or an error occurs.
source
Daisho.read_srtm_elevation_rastersFunction
read_srtm_elevation_rasters(filename::String, lat::Float64, lon::Float64) -> Union{Float64, Nothing}

Read a NASA SRTM .hgt file and extract the elevation at a specified latitude and longitude using Rasters.jl.

The SRTM file is loaded as a raster in WGS84 geographic coordinates, and the nearest-neighbor elevation value is returned. Void data values (-32768 or missing) return nothing.

Arguments

  • filename::String: Path to an SRTM .hgt file.
  • lat::Float64: Latitude in decimal degrees (positive north).
  • lon::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters at the specified coordinates.
  • nothing: If the elevation data is missing or void at the location.

Throws

  • ErrorException: If the coordinates are outside the raster bounds.
source
read_srtm_elevation_rasters(raster_dem::Raster, lat::Float64, lon::Float64) -> Union{Float64, Nothing}

Extract the elevation at a specified latitude and longitude from an already-loaded SRTM Raster object.

This method avoids re-reading the file from disk by accepting a pre-loaded Raster. The nearest-neighbor elevation value is returned. Void data values (-32768 or missing) return nothing.

Arguments

  • raster_dem::Raster: A pre-loaded SRTM raster in WGS84 geographic coordinates.
  • lat::Float64: Latitude in decimal degrees (positive north).
  • lon::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters at the specified coordinates.
  • nothing: If the elevation data is missing or void at the location.

Throws

  • ErrorException: If the coordinates are outside the raster bounds.
source
Daisho.read_srtm_elevation_multiFunction
read_srtm_elevation_multi(tile_directory::String, lat::Float64, lon::Float64) -> Union{Float64, Nothing}

Look up terrain elevation from SRTM tiles stored in a directory for a given latitude and longitude.

The appropriate SRTM tile filename is automatically determined from the coordinates using standard naming conventions (e.g., N16W025.hgt). If the tile file does not exist, ocean is assumed and nothing is returned.

Arguments

  • tile_directory::String: Path to directory containing SRTM .hgt tile files.
  • lat::Float64: Latitude in decimal degrees (positive north).
  • lon::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters at the specified coordinates.
  • nothing: If the tile is missing (assumed ocean) or elevation data is void.
source
read_srtm_elevation_multi(tile_directory::String) -> Dict{String, Raster}

Load all SRTM .hgt tile files from a directory into memory as a dictionary of Raster objects.

Each tile is keyed by its base name without extension (e.g., "N16W025"). The returned dictionary can be passed to terrain_height(tiles, lat, lon) for efficient repeated lookups without disk I/O.

Arguments

  • tile_directory::String: Path to directory containing SRTM .hgt tile files.

Returns

  • Dict{String, Raster}: Dictionary mapping tile name strings to loaded Raster objects.
source
Daisho.read_srtm_elevation_dictFunction
read_srtm_elevation_dict(tiles::Dict{String, Raster}, lat::Float64, lon::Float64) -> Union{Float64, Nothing}

Look up terrain elevation from a pre-loaded dictionary of SRTM raster tiles.

The appropriate tile name is determined from the coordinates using standard SRTM naming conventions. If the tile is not present in the dictionary, ocean is assumed and nothing is returned.

Arguments

  • tiles::Dict{String, Raster}: Dictionary mapping tile name strings (e.g., "N16W025") to loaded Raster objects.
  • lat::Float64: Latitude in decimal degrees (positive north).
  • lon::Float64: Longitude in decimal degrees (positive east).

Returns

  • Float64: Elevation in meters at the specified coordinates.
  • nothing: If the tile is not in the dictionary (assumed ocean) or elevation data is void.
source