Places UI Kit: A ready-to-use library that provides room for customization and low-code development. Try it out, and share yourinput on your UI Kit experience.

Elevation

ElevationServiceclass

google.maps.ElevationServiceclass

Defines a service class that talks directly to Google servers for requesting elevation data.

Access by callingconst {ElevationService} = await google.maps.importLibrary("elevation").
SeeLibraries in the Maps JavaScript API.

Constructor

ElevationService
ElevationService()
Parameters:  None
Creates a new instance of aElevationService that sends elevation queries to Google servers.

Methods

getElevationAlongPath
getElevationAlongPath(request[, callback])
Parameters: 
Makes an elevation request along a path, where the elevation data are returned as distance-based samples along that path.
getElevationForLocations
getElevationForLocations(request[, callback])
Parameters: 
Makes an elevation request for a list of discrete locations.

LocationElevationRequestinterface

google.maps.LocationElevationRequestinterface

An elevation request sent by theElevationService containing the list of discrete coordinates (LatLngs) for which to return elevation data.

Properties

locationsoptional
Type: Array<LatLng|LatLngLiteral>optional
The discrete locations for which to retrieve elevations.

LocationElevationResponseinterface

google.maps.LocationElevationResponseinterface

An elevation response returned by theElevationService containing the list ofElevationResults matching the locations of theLocationElevationRequest.

Properties

results
The list ofElevationResults matching the locations of theLocationElevationRequest.

PathElevationRequestinterface

google.maps.PathElevationRequestinterface

An elevation query sent by theElevationService containing the path along which to return sampled data. This request defines a continuous path along the earth along which elevation samples should be taken at evenly-spaced distances. All paths from vertex to vertex use segments of the great circle between those two points.

Properties

samples
Type: number
Required. The number of equidistant points along the given path for which to retrieve elevation data, including the endpoints. The number of samples must be a value between 2 and 512 inclusive.
pathoptional
Type: Array<LatLng|LatLngLiteral>optional
The path along which to collect elevation values.

PathElevationResponseinterface

google.maps.PathElevationResponseinterface

An elevation response returned by theElevationService containing the list ofElevationResults evenly-spaced along the path of thePathElevationRequest.

Properties

results
The list ofElevationResults matching the samples of thePathElevationRequest.

ElevationResultinterface

google.maps.ElevationResultinterface

The result of anElevationService request, consisting of the set of elevation coordinates and their elevation values. Note that a single request may produce multipleElevationResults.

Properties

elevation
Type: number
The elevation of this point on Earth, in meters above sea level.
resolution
Type: number
The distance, in meters, between sample points from which the elevation was interpolated. This property will be missing if the resolution is not known. Note that elevation data becomes more coarse (largerresolution values) when multiple points are passed. To obtain the most accurate elevation value for a point, it should be queried independently.
locationoptional
Type: LatLngoptional
The location of this elevation result.

ElevationStatusconstants

google.maps.ElevationStatusconstants

The status returned by theElevationService upon completion of an elevation request. Specify these by value, or by using the constant's name. For example,'OK' orgoogle.maps.ElevationStatus.OK.

Access by callingconst {ElevationStatus} = await google.maps.importLibrary("elevation").
SeeLibraries in the Maps JavaScript API.

Constants

INVALID_REQUESTThe request was invalid.
OKThe request did not encounter any errors.
OVER_QUERY_LIMITThe webpage has gone over the requests limit in too short a period of time.
REQUEST_DENIEDThe webpage is not allowed to use the elevation service.
UNKNOWN_ERRORThe elevation request could not be successfully processed, yet the exact reason for the failure is not known.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-18 UTC.