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

The same lookup in other providers' formats

If you already have code written against one of these providers, keep it: the drop-in host accepts the same path and parameters and answers in that provider's response shape, with this endpoint behind it. See how the drop-ins work.

ProviderHostPath
Google Maps Platformgapi.mygeocode.com/maps/api/elevation/json?locations=lat,lng|lat,lng
Bing Maps REST Servicesbing.mygeocode.com/REST/v1/Elevation/List?points=lat,lon,lat,lon
Open-Elevationopenelevation.mygeocode.com/api/v1/lookup?locations=lat,lon|lat,lon
/api/v1/lookup (POST, JSON body)

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.