Elevation Widget (alpha)

ElevationElement class

google.maps.elevation.ElevationElement class

An HTML element that visually displays elevation data. Set the element's path property to show a graph of elevation along the path. To use the Elevation Element, enable the Places UI Kit API for your project in the Google Cloud console.

Custom element:
<gmp-elevation unit-system="imperial"></gmp-elevation>

This class extends HTMLElement.

This class implements ElevationElementOptions.

Access by calling const {ElevationElement} = await google.maps.importLibrary("elevation"). See Libraries in the Maps JavaScript API.

ElevationElement
ElevationElement([options])
Parameters: 
path
The path along which to show elevation data. Line segments will be interpolated in between the points of the array; even a small number of points will still produce a detailed elevation graph.
If only one point is provided, the widget will show the elevation number for that point.
unitSystem
Type:  UnitSystem optional
Determines if elevation will be shown in feet/miles or meters/km. If undefined, the widget will default to the preferred unit system for the region specified in the API loader.
HTML attribute:
  • <gmp-elevation unit-system="imperial"></gmp-elevation>
  • <gmp-elevation unit-system="metric"></gmp-elevation>
BetaaddEventListener
addEventListener(type, listener[, options])
Parameters: 
  • typestring A case-sensitive string representing the event type to listen for.
  • listenerEventListener|EventListenerObject The object that receives a notification. This must be a function or an object with the handleEvent method
  • optionsboolean|AddEventListenerOptions optional See options. Custom events only support capture and passive.
Return Value:  void
Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener
BetaremoveEventListener
removeEventListener(type, listener[, options])
Parameters: 
Return Value:  void
Removes an event listener previously registered with addEventListener from the target. See removeEventListener
gmp-load
function(event)
Arguments: 
This event is fired when the element loads and renders its content. This event does not bubble.
gmp-requesterror
function(event)
Arguments: 
This event is fired when a request to the backend was denied (e.g. incorrect API key). This event does not bubble.

ElevationElementOptions interface

google.maps.elevation.ElevationElementOptions interface

Options for ElevationElement.

path optional
Type:  Array<LatLng|LatLngLiteral> optional
unitSystem optional
Type:  UnitSystem optional