Routes Widget

Route3DElement class

class google.maps.routes.Route3DElement extends HTMLElement implements Route3DElementOptions
library "routes"

A web component for 3D route rendering. Currently support origin and destination parameters to render a polyline in 3D space in a 3D map.

     
<gmp-route-3d
  autofits-camera
  departure-time="####-##-##T##:##Z"
  destination="lat,lng"
  internal-usage-attribution-ids="space separated strings"
  origin="lat,lng"
  routing-preference="value-name"
  travel-mode="value-name">
</gmp-route-3d>
const {Route3DElement} = await google.maps.importLibrary("routes");
Route3DElement
Route3DElement([options])
Parameters:
Creates a Route3DElement with the options specified.
autofitsCamera
attr: autofits-camera
Input type: boolean optional
Output type: boolean
Default: false
If provided, the specified route will be made visible within the map viewport, alongside any other elements that have opted in.
HTML attribute: autofits-camera
departureTime
attr: departure-time
Input type: Date optional
Output type: Date optional
If provided, the route will be computed with the specified departure time. When specifying via HTML attribute, use the ISO 8601 format for reliable results across browsers. For information on usage requirements, see ComputeRoutesRequest.departureTime.
HTML attribute: departure-time="####-##-##T##:##Z"
destination
attr: destination
The destination of the route.
HTML attribute:
  • destination="lat,lng"
  • destination="places/###"
  • destination="address"
fallbackInfo
readonly
Type: FallbackInfo optional
Fallback info for the computed routes.
geocodingResults
readonly
Type: GeocodingResults optional
Geocoding results for the origin and destination.
internalUsageAttributionIds
attr: internal-usage-attribution-ids
Input type: Iterable<string> optional
Output type: Array<string> optional
Identifiers used to attribute calls to specific packages or OSS libraries.
HTML attribute: internal-usage-attribution-ids="space separated strings"
origin
attr: origin
The origin of the route.
HTML attribute:
  • origin="lat,lng"
  • origin="places/###"
  • origin="address"
routes
readonly
Type: Array<Route> optional
The primary route along with optional alternate routes, computed from the Routes API.
routingPreference
attr: routing-preference
Input type: RoutingPreference optional
Output type: RoutingPreference optional
If provided, the route will be computed with traffic information along the route that's based on the RoutingPreference specified, and use traffic-specific coloring.
HTML attribute: routing-preference="value-name"
travelMode
attr: travel-mode
Input type: TravelMode optional
Output type: TravelMode optional
If provided, the polyline is based on the specified travel mode.
HTML attribute: travel-mode="value-name"
Inherited: addEventListener, removeEventListener
Alphagmp-error
function(routeInitializationErrorEvent)
Arguments:
  • routeInitializationErrorEvent: Event optional
This event is fired when the route fails to load.
Alphagmp-load
function(routeInitializationSuccessEvent)
Arguments:
  • routeInitializationSuccessEvent: Event optional
This event is fired when the route successfully loads.

Route3DElementOptions interface

interface google.maps.routes.Route3DElementOptions

Route3DElementOptions object used to define the properties that can be set on a Route3DElement.

autofitsCamera
optional
Type: boolean optional
Whether or not to opt into automatically fitting the camera to the route.
departureTime
optional
Type: Date optional
destination
optional
internalUsageAttributionIds
optional
Type: Iterable<string> optional
Identifiers used to attribute calls to specific packages or OSS libraries.
origin
optional
routingPreference
optional
Type: RoutingPreference optional
travelMode
optional
Type: TravelMode optional