Elevation lookup

Metres above mean sea level for one or many points.

GEThttps://api.mygeocode.com/v1/elevation

Parameters

ParameterTypeDescription
lat, lonrequired*numberA single point.
locationsrequired*string*Alternative to lat and lon: up to 100 points as lat,lon|lat,lon|.... Each point counts as one request.
keyoptionalstringAPI key, if not sent as a header.

The endpoint also accepts POST with a JSON body {"locations": [[lat, lon], ...]} for long lists that would not fit in a URL.

Example

$ curl "https://api.mygeocode.com/v1/elevation?locations=36.2381,-116.8175|31.5590,35.4732"
const points = [[36.2381, -116.8175], [31.5590, 35.4732]];
const url = new URL("https://api.mygeocode.com/v1/elevation");
url.searchParams.set("locations", points.map((p) => p.join(",")).join("|"));

const { results } = await (await fetch(url)).json();
results.forEach((r) => console.log(r.elevation_m));
import requests

points = [(36.2381, -116.8175), (31.5590, 35.4732)]
locations = "|".join(f"{lat},{lon}" for lat, lon in points)
r = requests.get("https://api.mygeocode.com/v1/elevation", params={"locations": locations}, timeout=10)
for item in r.json()["results"]:
    print(item["elevation_m"])
Response
{
  "status": "ok",
  "results": [
    { "lat": 36.2381, "lon": -116.8175, "elevation_m": -85.4, "resolution_m": 30 },
    { "lat": 31.559, "lon": 35.4732, "elevation_m": -430.2, "resolution_m": 30 }
  ]
}

Response fields

FieldTypeDescription
resultsarrayOne entry per point, in input order.
results[].elevation_mnumber or nullMetres above mean sea level, one decimal. Negative below sea level. null over open ocean.
results[].resolution_mintegerCell size of the dataset that answered: 30 or 90.

Notes

Errors

400 invalid_request when neither a point nor locations is given, when a coordinate is out of range or malformed, or when there are more than 100 points.