View Source SRTM (SRTM v0.7.0)

A simple interface to query locations on the Earth for elevation data from the NASA Shuttle Radar Topography Mission (SRTM).

Summary

Types

Elevation (in meters)

A geographic coordinate that specifies the north–south position of a point on the surface of the Earth.

A geographic coordinate that specifies the east–west position of a point on the surface of the Earth.

Functions

Queries locations on the earth for elevation data.

Types

@type elevation() :: integer()

Elevation (in meters)

@type latitude() :: number()

A geographic coordinate that specifies the north–south position of a point on the surface of the Earth.

@type longitude() :: number()

A geographic coordinate that specifies the east–west position of a point on the surface of the Earth.

Functions

Link to this function

get_elevation(client, latitude, longitude)

View Source
@spec get_elevation(SRTM.Client.t(), latitude(), longitude()) ::
  {:ok, elevation() | nil, SRTM.Client.t()} | {:error, SRTM.Error.t()}

Queries locations on the earth for elevation data.

If the corresponding file can't be found in the cache, it will be retrieved online.

Returns the elevation in meters.

Note

  • Make sure to match on the client to always use the latests client struct. Otherwise the SRTM files will be re-read into memory on every call!

  • The SRTM files are cached in memory. Querying many coordinates at different locations may therefore take up a lot of memory space. See SRTM.Client.purge_in_memory_cache/2.

Examples

iex> {:ok, client} = SRTM.Client.new("./cache")
iex> {:ok, elevation, client} = SRTM.get_elevation(client, 36.455556, -116.866667)
{:ok, -51, %SRTM.Client{}}