Google Maps Elevation
Google Maps Elevation API Documentation
This document describes how to use the Google Maps Elevation API to retrieve elevation data for specific geographic locations or paths on Earth’s surface.
Base Endpoint
To request elevation data, use the following endpoint:
https://maps.googleapis.com/maps/api/elevation/json?parameters
Replace parameters
with query arguments such as locations
, path
, and your key
.
1. Basic Elevation Request
Endpoint Example
https://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536,-104.9847034&key=YOUR_API_KEY
This request returns the elevation for one or more geographic coordinates.
Parameters
locations
string
One or more latitude/longitude pairs separated by `
key
string
Your Google Cloud API key with the Elevation API enabled.
Response Fields
results
array
Contains one or more elevation results.
elevation
float
Elevation of the location in meters above sea level.
location.lat
float
Latitude of the requested point.
location.lng
float
Longitude of the requested point.
resolution
float
Maximum distance between data points from which the elevation was interpolated, in meters.
status
string
Status of the request (e.g., OK
, INVALID_REQUEST
, OVER_QUERY_LIMIT
, REQUEST_DENIED
, UNKNOWN_ERROR
).
2. Path Elevation Request
Endpoint Example
https://maps.googleapis.com/maps/api/elevation/json?path=36.578581,-118.291994|36.23998,-116.83171&samples=3&key=YOUR_API_KEY
This returns elevation values along a path between multiple coordinates.
Parameters
path
string
A set of two or more latitude/longitude pairs defining a path, separated by `
samples
integer
The number of equally spaced points along the path to sample for elevation.
key
string
Your API key.
Response Example
{
"results": [
{
"elevation": 1608.637939453125,
"location": {"lat": 36.578581, "lng": -118.291994},
"resolution": 4.771975994110107
},
{
"elevation": 1523.73828125,
"location": {"lat": 36.400433, "lng": -117.561852},
"resolution": 4.771975994110107
},
{
"elevation": -64.37896728515625,
"location": {"lat": 36.23998, "lng": -116.83171},
"resolution": 19.08790397644043
}
],
"status": "OK"
}
3. Common Response Fields
results
array
Contains one or more elevation data points.
results[].elevation
float
Elevation in meters above sea level.
results[].location.lat
float
Latitude of the elevation point.
results[].location.lng
float
Longitude of the elevation point.
results[].resolution
float
Maximum resolution (in meters) of the elevation data.
status
string
Status code indicating the success or failure of the request.
4. Error Status Codes
OK
Request succeeded.
INVALID_REQUEST
The request is missing a required parameter or has an invalid value.
OVER_QUERY_LIMIT
The request exceeded your usage quota.
REQUEST_DENIED
The request was denied, often due to an invalid or restricted API key.
UNKNOWN_ERROR
A server error occurred. Try again later.
Example Use Case
Retrieve the elevation profile along a hiking trail
curl "https://maps.googleapis.com/maps/api/elevation/json?path=34.11,-118.11|34.13,-118.15&samples=5&key=YOUR_API_KEY"
This returns five elevation points evenly spaced along the specified path, allowing you to plot an elevation profile.
Last updated