Introducing Places UI Kit: A ready-to-use, low-cost component library that lets you bring the familiar Google Maps UI for Places to any map of your choice. Try it out, andshare your input to help shape the future of GMP!

3D Maps

Map3DElementclass

google.maps.maps3d.Map3DElementclass

Notice: Available only in thev=beta channel.

Map3DElement is an HTML interface for the 3D Map view. Note that themode must be set for the 3D Map to start rendering.

Custom element:
<gmp-map-3d center="lat,lng,altitude" default-ui-disabled heading="number" internal-usage-attribution-ids="id1 id2" max-altitude="number" max-heading="number" max-tilt="number" min-altitude="number" min-heading="number" min-tilt="number" mode="hybrid" range="number" roll="number" tilt="number"></gmp-map-3d>

This class extendsHTMLElement.

This class implementsMap3DElementOptions.

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

Constructor

Map3DElement
Map3DElement([options])
Parameters: 

Properties

bounds
When set, restricts the position of the camera within the specified lat/lng bounds. Note that objects outside the bounds are still rendered. Bounds can restrict both longitude and latitude, or can restrict either latitude or longitude only. For latitude-only bounds use west and east longitudes of-180 and180, respectively. For longitude-only bounds use north and south latitudes of90 and-90, respectively.
center
The center of the map given as a LatLngAltitude, where altitude is in meters above ground level. Note that this is not necessarily where the camera is located, as therange field affects the camera's distance from the map center. If not set, defaults to{lat: 0, lng: 0, altitude: 63170000}. 63170000 meters is a maximum allowed altitude (Earth radius multiplied by 10).
HTML attribute:
  • <gmp-map-3d center="lat,lng,altitude"></gmp-map-3d>
defaultUIDisabled
Type: booleanoptional
Default:false
Whentrue, all default UI buttons are disabled. Does not disable the keyboard and gesture controls.
HTML attribute:
  • <gmp-map-3d default-ui-disabled></gmp-map-3d>
heading
Type: numberoptional
The compass heading of the map, in degrees, where due north is zero. When there is no tilt, any roll will be interpreted as heading.
HTML attribute:
  • <gmp-map-3d heading="number"></gmp-map-3d>
internalUsageAttributionIds
Type: Iterable<string>optional
Adds a usage attribution ID to the initializer, which helps Google understand which libraries and samples are helpful to developers, such as usage of a marker clustering library. To opt out of sending the usage attribution ID, it is safe to delete this property. Only unique values will be sent. Changes to this value after instantiation may be ignored.
HTML attribute:
  • <gmp-map-3d internal-usage-attribution-ids="id1 id2"></gmp-map-3d>
maxAltitude
Type: numberoptional
The maximum altitude above the ground which will be displayed on the map. A valid value is between0 and63170000 meters (Earth radius multiplied by 10).
HTML attribute:
  • <gmp-map-3d max-altitude="number"></gmp-map-3d>
maxHeading
Type: numberoptional
The maximum angle of heading (rotation) of the map. A valid value is between0 and360 degrees.minHeading andmaxHeading represent an interval of <=360 degrees in which heading gestures will be allowed.minHeading = 180 andmaxHeading = 90 will allow heading in[0, 90] and heading in[180, 360].minHeading = 90 andmaxHeading = 180 will allow heading in[90, 180].
HTML attribute:
  • <gmp-map-3d max-heading="number"></gmp-map-3d>
maxTilt
Type: numberoptional
The maximum angle of incidence of the map. A valid value is between0 and90 degrees.
HTML attribute:
  • <gmp-map-3d max-tilt="number"></gmp-map-3d>
minAltitude
Type: numberoptional
The minimum altitude above the ground which will be displayed on the map. A valid value is between0 and63170000 meters (Earth radius multiplied by 10).
HTML attribute:
  • <gmp-map-3d min-altitude="number"></gmp-map-3d>
minHeading
Type: numberoptional
The minimum angle of heading (rotation) of the map. A valid value is between0 and360 degrees.minHeading andmaxHeading represent an interval of <=360 degrees in which heading gestures will be allowed.minHeading = 180 andmaxHeading = 90 will allow heading in[0, 90] and heading in[180, 360].minHeading = 90 andmaxHeading = 180 will allow heading in[90, 180].
HTML attribute:
  • <gmp-map-3d min-heading="number"></gmp-map-3d>
minTilt
Type: numberoptional
The minimum angle of incidence of the map. A valid value is between0 and90 degrees.
HTML attribute:
  • <gmp-map-3d min-tilt="number"></gmp-map-3d>
mode
Type: MapModeoptional
Specifies a mode the map should be rendered in. If not set, the map won't be rendered.
HTML attribute:
  • <gmp-map-3d mode="hybrid"></gmp-map-3d>
  • <gmp-map-3d mode="satellite"></gmp-map-3d>
range
Type: numberoptional
The distance from camera to the center of the map, in meters.
HTML attribute:
  • <gmp-map-3d range="number"></gmp-map-3d>
roll
Type: numberoptional
The roll of the camera around the view vector in degrees. To resolve ambiguities, when there is no tilt, any roll will be interpreted as heading.
HTML attribute:
  • <gmp-map-3d roll="number"></gmp-map-3d>
tilt
Type: numberoptional
The tilt of the camera's view vector in degrees. A view vector looking directly down at the earth would have a tilt of zero degrees. A view vector pointing away from the earth would have a tilt of180 degrees.
HTML attribute:
  • <gmp-map-3d tilt="number"></gmp-map-3d>

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
flyCameraAround
flyCameraAround(options)
Parameters: 
Return Value:  None
This method orbits the camera around a given location for a given duration, making the given number of rounds in that time.

By default, the camera orbits clockwise. If given a negative number for rounds, the camera will orbit in a counter-clockwise direction instead.

The method is asynchronous because animations can only start after the map has loaded a minimum amount. The method returns once the animation has been started.

If the number of rounds is zero, no spin will occur, and the animation will complete immediately after it starts.
flyCameraTo
flyCameraTo(options)
Parameters: 
Return Value:  None
This method moves the camera parabolically from the current location to a given end location over a given duration.

The method is asynchronous because animations can only start after the map has loaded a minimum amount. The method returns once the animation has been started.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.
stopCameraAnimation
stopCameraAnimation()
Parameters:  None
Return Value:  None
This method stops any fly animation that might happen to be running. The camera stays wherever it is mid-animation; it does not teleport to the end point.

The method is asynchronous because animations can only start or stop after the map has loaded a minimum amount. The method returns once the animation has stopped.

Events

gmp-animationend
function(animationEndEvent)
Arguments: 
  • animationEndEventEvent
This event is fired when the fly animation ends. This event bubbles up through the DOM tree.
gmp-centerchange
function(centerChangeEvent)
Arguments: 
  • centerChangeEventEvent
This event is fired when the Map3DElement's center property changes.
gmp-click
function(clickEvent)
Arguments: 
This event is fired when theMap3DElement element is clicked.
gmp-headingchange
function(headingChangeEvent)
Arguments: 
  • headingChangeEventEvent
This event is fired when the Map3DElement's heading property changes.
gmp-rangechange
function(rangeChangeEvent)
Arguments: 
This event is fired when the Map3DElement's range property changes.
gmp-rollchange
function(rollChangeEvent)
Arguments: 
This event is fired when the Map3DElement's roll property changes.
gmp-steadychange
function(steadyChangeEvent)
Arguments: 
This event is fired when the steady state ofMap3DElement changes.
gmp-tiltchange
function(tiltChangeEvent)
Arguments: 
This event is fired when the Map3DElement's tilt property changes.

Map3DElementOptionsinterface

google.maps.maps3d.Map3DElementOptionsinterface

Notice: Available only in thev=beta channel.

Map3DElementOptions object used to define the properties that can be set on a Map3DElement.

Properties

boundsoptional
centeroptional
defaultUIDisabledoptional
Type: booleanoptional
headingoptional
Type: numberoptional
internalUsageAttributionIdsoptional
Type: Iterable<string>optional
maxAltitudeoptional
Type: numberoptional
maxHeadingoptional
Type: numberoptional
maxTiltoptional
Type: numberoptional
minAltitudeoptional
Type: numberoptional
minHeadingoptional
Type: numberoptional
minTiltoptional
Type: numberoptional
modeoptional
Type: MapModeoptional
rangeoptional
Type: numberoptional
rolloptional
Type: numberoptional
tiltoptional
Type: numberoptional

MapModeconstants

google.maps.maps3d.MapModeconstants

Notice: Available only in thev=beta channel.

Specifies a mode the map should be rendered in.

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

Constants

HYBRIDThis map mode displays a transparent layer of major streets on satellite, or photorealistic imagery.
SATELLITEThis map mode displays satellite, or photorealistic imagery where available.

FlyAroundAnimationOptionsinterface

google.maps.maps3d.FlyAroundAnimationOptionsinterface

Notice: Available only in thev=beta channel.

Customization options for the FlyCameraAround Animation.

Properties

camera
The central point at which the camera should look at during the orbit animation. Note that the map heading will change as the camera orbits around this center point.
durationMillisoptional
Type: numberoptional
The duration of the animation in milliseconds. This is the total duration of the animation, not the duration of a single rotation.
roundsoptional
Type: numberoptional
The number of rounds to rotate around the center in the given duration. This controls the overall speed of rotation. Passing a negative number to rounds will cause the camera to rotate in a counter-clockwise direction instead of the default clockwise direction.

FlyToAnimationOptionsinterface

google.maps.maps3d.FlyToAnimationOptionsinterface

Notice: Available only in thev=beta channel.

Customization options for the FlyCameraTo Animation.

Properties

endCamera
The location at which the camera should point at the end of the animation.
durationMillisoptional
Type: numberoptional
The duration of the animation in milliseconds. A duration of 0 will teleport the camera straight to the end position.

CameraOptionsinterface

google.maps.maps3d.CameraOptionsinterface

Notice: Available only in thev=beta channel.

CameraOptions object used to define the properties that can be set on a camera object. The camera object can be anything that has a camera position, e.g. a current map state, or a future requested animation state.

Properties

centeroptional
headingoptional
Type: numberoptional
rangeoptional
Type: numberoptional
rolloptional
Type: numberoptional
tiltoptional
Type: numberoptional

SteadyChangeEventclass

google.maps.maps3d.SteadyChangeEventclass

Notice: Available only in thev=beta channel.

This event is created from monitoring a steady state ofMap3DElement. This event bubbles up through the DOM tree.

This class extendsEvent.

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

Properties

isSteady
Type: boolean
Indicates whether Map3DElement is steady (i.e. all rendering for the current scene has completed) or not.

LocationClickEventclass

google.maps.maps3d.LocationClickEventclass

Notice: Available only in thev=beta channel.

This event is created from clicking a Map3DElement.

This class extendsEvent.

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

Properties

position
Type: LatLngAltitudeoptional
The latitude/longitude/altitude that was below the cursor when the event occurred. Please note, that at coarser levels, less accurate data will be returned. Also, sea floor elevation may be returned for the altitude value when clicking at the water surface from higher camera positions. This event bubbles up through the DOM tree.

PlaceClickEventclass

google.maps.maps3d.PlaceClickEventclass

Notice: Available only in thev=beta channel.

This event is created from clicking on a place icon on aMap3DElement. To prevent the default popover from showing up, call thepreventDefault() method on this event to prevent it being handled by theMap3DElement.

This class extendsLocationClickEvent.

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

Properties

placeId
Type: string
The place id of the map feature.
Inherited:position

Methods

fetchPlace
fetchPlace()
Parameters:  None
Return Value: Promise<Place>
Fetches aPlace for this place id. In the resultingPlace object, the id property will be populated. Additional fields can be subsequently requested viaPlace.fetchFields() subject to normal Places API enablement and billing. The promise is rejected if there was an error fetching thePlace.

Marker3DElementclass

google.maps.maps3d.Marker3DElementclass

Notice: Available only in thev=beta channel.

Shows a position on a 3D map. Note that theposition must be set for theMarker3DElement to display.

Custom element:
<gmp-marker-3d altitude-mode="absolute" collision-behavior="required" draws-when-occluded extruded label="string" position="lat,lng" size-preserved z-index="number"></gmp-marker-3d>

This class extendsHTMLElement.

This class implementsMarker3DElementOptions.

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

Constructor

Marker3DElement
Marker3DElement([options])
Parameters: 
Creates anMarker3DElement with the options specified.

Properties

altitudeMode
Type: AltitudeModeoptional
Specifies how the altitude component of the position is interpreted.
HTML attribute:
  • <gmp-marker-3d altitude-mode="absolute"></gmp-marker-3d>
  • <gmp-marker-3d altitude-mode="clamp-to-ground"></gmp-marker-3d>
  • <gmp-marker-3d altitude-mode="relative-to-ground"></gmp-marker-3d>
  • <gmp-marker-3d altitude-mode="relative-to-mesh"></gmp-marker-3d>
collisionBehavior
Type: CollisionBehavioroptional
An enumeration specifying how a Marker3DElement should behave when it collides with another Marker3DElement or with the basemap labels.
HTML attribute:
  • <gmp-marker-3d collision-behavior="required"></gmp-marker-3d>
  • <gmp-marker-3d collision-behavior="required-and-hides-optional"></gmp-marker-3d>
  • <gmp-marker-3d collision-behavior="optional-and-hides-lower-priority"></gmp-marker-3d>
drawsWhenOccluded
Type: booleanoptional
Default:false
Specifies whether this marker should be drawn or not when it's occluded. The marker can be occluded by map geometry (e.g. buildings).
HTML attribute:
  • <gmp-marker-3d draws-when-occluded></gmp-marker-3d>
extruded
Type: booleanoptional
Default:false
Specifies whether to connect the marker to the ground. To extrude a marker, thealtitudeMode must be eitherRELATIVE_TO_GROUND orABSOLUTE.
HTML attribute:
  • <gmp-marker-3d extruded></gmp-marker-3d>
label
Type: stringoptional
Text to be displayed by this marker.
HTML attribute:
  • <gmp-marker-3d label="string"></gmp-marker-3d>
position
The location of the tip of the marker. Altitude is ignored in certain modes and thus optional.
HTML attribute:
  • <gmp-marker-3d position="lat,lng"></gmp-marker-3d>
  • <gmp-marker-3d position="lat,lng,altitude"></gmp-marker-3d>
sizePreserved
Type: booleanoptional
Default:false
Specifies whether this marker should preserve its size or not regardless of distance from camera. By default, the marker is scaled based on distance from camera/tilt.
HTML attribute:
  • <gmp-marker-3d size-preserved></gmp-marker-3d>
zIndex
Type: numberoptional
The zIndex compared to other markers.
HTML attribute:
  • <gmp-marker-3d z-index="number"></gmp-marker-3d>

Slots

default
Any custom elements directly added to theMarker3DElement will be slotted, however only elements ofHTMLImageElement,SVGElement andPinElement types will be used for drawing markers, other elements will be ignored.
HTMLImageElement andSVGElement must be wrapped in<template> element before assigning to theMarker3DElement's default slot.

Images and SVGs are currently rasterized before they are rendered in the 3D scene, so custom HTML embedded into SVG or CSS classes added to images won't be applied and might not be reflected when markers are displayed on the screen.

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Marker3DElementOptionsinterface

google.maps.maps3d.Marker3DElementOptionsinterface

Notice: Available only in thev=beta channel.

Marker3DElementOptions object used to define the properties that can be set on a Marker3DElement.

Properties

altitudeModeoptional
Type: AltitudeModeoptional
collisionBehavioroptional
Type: CollisionBehavioroptional
drawsWhenOccludedoptional
Type: booleanoptional
extrudedoptional
Type: booleanoptional
labeloptional
Type: stringoptional
positionoptional
sizePreservedoptional
Type: booleanoptional
zIndexoptional
Type: numberoptional

Marker3DInteractiveElementclass

google.maps.maps3d.Marker3DInteractiveElementclass

Notice: Available only in thev=beta channel.

Shows a position on a 3D map. Note that theposition must be set for theMarker3DInteractiveElement to display. UnlikeMarker3DElement,Marker3DInteractiveElement receives agmp-click event.

Custom element:
<gmp-marker-3d-interactive gmp-popover-target="popover-id" title="string"></gmp-marker-3d-interactive>

This class extendsMarker3DElement.

This class implementsMarker3DInteractiveElementOptions.

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

Constructor

Marker3DInteractiveElement
Marker3DInteractiveElement([options])
Parameters: 
Creates anMarker3DInteractiveElement with the options specified.

Properties

gmpPopoverTargetElement
Type: PopoverElementoptional
When set, the popover element will be open on this marker's click.
HTML attribute:
  • <gmp-marker-3d-interactive gmp-popover-target="popover-id"></gmp-marker-3d-interactive>
title
Type: string
Rollover text. If provided, an accessibility text (e.g. for use with screen readers) will be added to theMarker3DInteractiveElement with the provided value.
HTML attribute:
  • <gmp-marker-3d-interactive title="string"></gmp-marker-3d-interactive>
Inherited:altitudeMode,collisionBehavior,drawsWhenOccluded,extruded,label,position,sizePreserved,zIndex

Slots

default
Any custom elements directly added to theMarker3DInteractiveElement will be slotted, however only elements ofPinElement's type will be used for drawing markers, other elements will be ignored.

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Events

gmp-click
function(clickEvent)
Arguments: 
This event is fired when theMarker3DInteractiveElement element is clicked.

Marker3DInteractiveElementOptionsinterface

google.maps.maps3d.Marker3DInteractiveElementOptionsinterface

Notice: Available only in thev=beta channel.

Marker3DInteractiveElementOptions object used to define the properties that can be set on a Marker3DInteractiveElement.

This interface extendsMarker3DElementOptions.

Properties

gmpPopoverTargetElementoptional
Type: PopoverElementoptional
titleoptional
Type: stringoptional
Inherited:altitudeMode,collisionBehavior,drawsWhenOccluded,extruded,label,position,sizePreserved,zIndex

Model3DElementclass

google.maps.maps3d.Model3DElementclass

Notice: Available only in thev=beta channel.

A 3D model which allows the rendering of gLTF models. Note that theposition and thesrc must be set for theModel3DElement to display.

Core properties of thegLTF PBR should be supported. No extensions or extension properties are currently supported.

Custom element:
<gmp-model-3d altitude-mode="absolute" orientation="heading,tilt,roll" position="lat,lng" scale="number" src="url"></gmp-model-3d>

This class extendsHTMLElement.

This class implementsModel3DElementOptions.

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

Constructor

Model3DElement
Model3DElement([options])
Parameters: 
Creates anModel3DElement with the options specified.

Properties

altitudeMode
Type: AltitudeModeoptional
Specifies how altitude in the position is interpreted.
HTML attribute:
  • <gmp-model-3d altitude-mode="absolute"></gmp-model-3d>
  • <gmp-model-3d altitude-mode="clamp-to-ground"></gmp-model-3d>
  • <gmp-model-3d altitude-mode="relative-to-ground"></gmp-model-3d>
  • <gmp-model-3d altitude-mode="relative-to-mesh"></gmp-model-3d>
orientation
Describes rotation of a 3D model's coordinate system to position the model on the 3D Map.

Rotations are applied to the model in the following order: roll, tilt and then heading.
HTML attribute:
  • <gmp-model-3d orientation="heading,tilt,roll"></gmp-model-3d>
position
Sets theModel3DElement's position. Altitude is ignored in certain modes and thus optional.
HTML attribute:
  • <gmp-model-3d position="lat,lng"></gmp-model-3d>
  • <gmp-model-3d position="lat,lng,altitude"></gmp-model-3d>
scale
Type: number|Vector3D|Vector3DLiteraloptional
Default:1
Scales the model along the x, y, and z axes in the model's coordinate space.
HTML attribute:
  • <gmp-model-3d scale="number"></gmp-model-3d>
  • <gmp-model-3d scale="x,y,z"></gmp-model-3d>
src
Type: string|URLoptional
Specifies the url of the 3D model. At this time, only models in the.glb format are supported.

Any relative HTTP urls will be resolved to their corresponding absolute ones.

Please note that If you're hosting your.glb model files on a different website or server than your main application, make sure to set up the correct CORS HTTP headers. This allows your application to securely access the model files from the other domain.
HTML attribute:
  • <gmp-model-3d src="url"></gmp-model-3d>

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Model3DElementOptionsinterface

google.maps.maps3d.Model3DElementOptionsinterface

Notice: Available only in thev=beta channel.

Model3DElementOptions object used to define the properties that can be set on a Model3DElement.

Properties

altitudeModeoptional
Type: AltitudeModeoptional
orientationoptional
positionoptional
scaleoptional
Type: number|Vector3D|Vector3DLiteraloptional
srcoptional
Type: string|URLoptional

Model3DInteractiveElementclass

google.maps.maps3d.Model3DInteractiveElementclass

Notice: Available only in thev=beta channel.

A 3D model which allows the rendering of gLTF models. Note that theposition and thesrc must be set for theModel3DElement to display.

Core properties of thegLTF PBR should be supported. No extensions or extension properties are currently supported.

UnlikeModel3DElement,Model3DInteractiveElement receives agmp-click event.

Custom element:
<gmp-model-3d-interactive></gmp-model-3d-interactive>

This class extendsModel3DElement.

This class implementsModel3DInteractiveElementOptions.

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

Constructor

Model3DInteractiveElement
Model3DInteractiveElement([options])
Parameters: 
Creates aModel3DInteractiveElement with the options specified.

Properties

Inherited:altitudeMode,orientation,position,scale,src

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Events

gmp-click
function(clickEvent)
Arguments: 
This event is fired when theModel3DInteractiveElement element is clicked.

Model3DInteractiveElementOptionsinterface

google.maps.maps3d.Model3DInteractiveElementOptionsinterface

Notice: Available only in thev=beta channel.

Model3DInteractiveElementOptions object used to define the properties that can be set on a Model3DInteractiveElement.

This interface extendsModel3DElementOptions.

Properties

Inherited:altitudeMode,orientation,position,scale,src

Polyline3DElementclass

google.maps.maps3d.Polyline3DElementclass

Notice: Available only in thev=beta channel.

A 3D polyline is a linear overlay of connected line segments on a 3D map.

Custom element:
<gmp-polyline-3d altitude-mode="absolute" draws-occluded-segments extruded geodesic outer-color="string" outer-width="number" stroke-color="string" stroke-width="number" z-index="number"></gmp-polyline-3d>

This class extendsHTMLElement.

This class implementsPolyline3DElementOptions.

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

Constructor

Polyline3DElement
Polyline3DElement([options])
Parameters: 
Creates anPolyline3DElement with the options specified.

Properties

altitudeMode
Type: AltitudeModeoptional
Specifies how altitude components in the coordinates are interpreted.
HTML attribute:
  • <gmp-polyline-3d altitude-mode="absolute"></gmp-polyline-3d>
  • <gmp-polyline-3d altitude-mode="clamp-to-ground"></gmp-polyline-3d>
  • <gmp-polyline-3d altitude-mode="relative-to-ground"></gmp-polyline-3d>
  • <gmp-polyline-3d altitude-mode="relative-to-mesh"></gmp-polyline-3d>
coordinates
The ordered sequence of coordinates of the Polyline. Altitude is ignored in certain modes and thus optional.
drawsOccludedSegments
Type: booleanoptional
Default:false
Specifies whether parts of the polyline which could be occluded are drawn or not. Polylines can be occluded by map geometry (e.g. buildings).
HTML attribute:
  • <gmp-polyline-3d draws-occluded-segments></gmp-polyline-3d>
extruded
Type: booleanoptional
Default:false
Specifies whether to connect the polyline to the ground. To extrude a polyline, thealtitudeMode must be eitherRELATIVE_TO_GROUND orABSOLUTE.
HTML attribute:
  • <gmp-polyline-3d extruded></gmp-polyline-3d>
geodesic
Type: booleanoptional
Default:false
Whentrue, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth. Whenfalse, edges of the polyline are rendered as straight lines in screen space.
HTML attribute:
  • <gmp-polyline-3d geodesic></gmp-polyline-3d>
outerColor
Type: stringoptional
The outer color. All CSS3 colors are supported.
HTML attribute:
  • <gmp-polyline-3d outer-color="string"></gmp-polyline-3d>
outerWidth
Type: numberoptional
The outer width is between0.0 and1.0. This is a percentage of thestrokeWidth.
HTML attribute:
  • <gmp-polyline-3d outer-width="number"></gmp-polyline-3d>
strokeColor
Type: stringoptional
The stroke color. All CSS3 colors are supported.
HTML attribute:
  • <gmp-polyline-3d stroke-color="string"></gmp-polyline-3d>
strokeWidth
Type: numberoptional
The stroke width in pixels.
HTML attribute:
  • <gmp-polyline-3d stroke-width="number"></gmp-polyline-3d>
zIndex
Type: numberoptional
The zIndex compared to other polys.
HTML attribute:
  • <gmp-polyline-3d z-index="number"></gmp-polyline-3d>

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Polyline3DElementOptionsinterface

google.maps.maps3d.Polyline3DElementOptionsinterface

Notice: Available only in thev=beta channel.

Polyline3DElementOptions object used to define the properties that can be set on a Polyline3DElement.

Properties

altitudeModeoptional
Type: AltitudeModeoptional
coordinatesoptional
drawsOccludedSegmentsoptional
Type: booleanoptional
extrudedoptional
Type: booleanoptional
geodesicoptional
Type: booleanoptional
outerColoroptional
Type: stringoptional
outerWidthoptional
Type: numberoptional
strokeColoroptional
Type: stringoptional
strokeWidthoptional
Type: numberoptional
zIndexoptional
Type: numberoptional

Polyline3DInteractiveElementclass

google.maps.maps3d.Polyline3DInteractiveElementclass

Notice: Available only in thev=beta channel.

A 3D polyline is a linear overlay of connected line segments on a 3D map. UnlikePolyline3DElement,Polyline3DInteractiveElement receives agmp-click event.

Custom element:
<gmp-polyline-3d-interactive></gmp-polyline-3d-interactive>

This class extendsPolyline3DElement.

This class implementsPolyline3DInteractiveElementOptions.

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

Constructor

Polyline3DInteractiveElement
Polyline3DInteractiveElement([options])
Parameters: 
Creates aPolyline3DInteractiveElement with the options specified.

Properties

Inherited:altitudeMode,coordinates,drawsOccludedSegments,extruded,geodesic,outerColor,outerWidth,strokeColor,strokeWidth,zIndex

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Events

gmp-click
function(clickEvent)
Arguments: 
  • clickEventLocationClickEvent The event object will contain the lat-lng-altitude location of the click.
This event is fired when thePolyline3DInteractiveElement element is clicked.

Polyline3DInteractiveElementOptionsinterface

google.maps.maps3d.Polyline3DInteractiveElementOptionsinterface

Notice: Available only in thev=beta channel.

Polyline3DInteractiveElementOptions object used to define the properties that can be set on a Polyline3DInteractiveElement.

This interface extendsPolyline3DElementOptions.

Properties

Inherited:altitudeMode,coordinates,drawsOccludedSegments,extruded,geodesic,outerColor,outerWidth,strokeColor,strokeWidth,zIndex

Polygon3DElementclass

google.maps.maps3d.Polygon3DElementclass

Notice: Available only in thev=beta channel.

A 3D polygon (like a 3D polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled region.

Custom element:
<gmp-polygon-3d altitude-mode="absolute" draws-occluded-segments extruded fill-color="string" geodesic stroke-color="string" stroke-width="number" z-index="number"></gmp-polygon-3d>

This class extendsHTMLElement.

This class implementsPolygon3DElementOptions.

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

Constructor

Polygon3DElement
Polygon3DElement([options])
Parameters: 
Creates anPolygon3DElement with the options specified.

Properties

altitudeMode
Type: AltitudeModeoptional
Specifies how altitude components in the coordinates are interpreted.
HTML attribute:
  • <gmp-polygon-3d altitude-mode="absolute"></gmp-polygon-3d>
  • <gmp-polygon-3d altitude-mode="clamp-to-ground"></gmp-polygon-3d>
  • <gmp-polygon-3d altitude-mode="relative-to-ground"></gmp-polygon-3d>
  • <gmp-polygon-3d altitude-mode="relative-to-mesh"></gmp-polygon-3d>
drawsOccludedSegments
Type: booleanoptional
Default:false
Specifies whether parts of the polygon which could be occluded are drawn or not. Polygons can be occluded by map geometry (e.g. buildings).
HTML attribute:
  • <gmp-polygon-3d draws-occluded-segments></gmp-polygon-3d>
extruded
Type: booleanoptional
Default:false
Specifies whether to connect the polygon to the ground. To extrude a polygon, thealtitudeMode must be eitherRELATIVE_TO_GROUND orABSOLUTE.
HTML attribute:
  • <gmp-polygon-3d extruded></gmp-polygon-3d>
fillColor
Type: stringoptional
The fill color. All CSS3 colors are supported.
HTML attribute:
  • <gmp-polygon-3d fill-color="string"></gmp-polygon-3d>
geodesic
Type: booleanoptional
Default:false
Whentrue, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. Whenfalse, edges of the polygon are rendered as straight lines in screen space.
HTML attribute:
  • <gmp-polygon-3d geodesic></gmp-polygon-3d>
innerCoordinates
The ordered sequence of coordinates that designates a closed loop. Unlike polylines, a polygon may consist of one or more paths, which create multiple cut-outs inside the polygon.
outerCoordinates
The ordered sequence of coordinates that designates a closed loop. Altitude is ignored in certain modes and thus optional.
strokeColor
Type: stringoptional
The stroke color. All CSS3 colors are supported.
HTML attribute:
  • <gmp-polygon-3d stroke-color="string"></gmp-polygon-3d>
strokeWidth
Type: numberoptional
The stroke width in pixels.
HTML attribute:
  • <gmp-polygon-3d stroke-width="number"></gmp-polygon-3d>
zIndex
Type: numberoptional
The zIndex compared to other polys.
HTML attribute:
  • <gmp-polygon-3d z-index="number"></gmp-polygon-3d>

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Polygon3DElementOptionsinterface

google.maps.maps3d.Polygon3DElementOptionsinterface

Notice: Available only in thev=beta channel.

Polygon3DElementOptions object used to define the properties that can be set on a Polygon3DElement.

Properties

altitudeModeoptional
Type: AltitudeModeoptional
drawsOccludedSegmentsoptional
Type: booleanoptional
extrudedoptional
Type: booleanoptional
fillColoroptional
Type: stringoptional
geodesicoptional
Type: booleanoptional
innerCoordinatesoptional
outerCoordinatesoptional
strokeColoroptional
Type: stringoptional
strokeWidthoptional
Type: numberoptional
zIndexoptional
Type: numberoptional

Polygon3DInteractiveElementclass

google.maps.maps3d.Polygon3DInteractiveElementclass

Notice: Available only in thev=beta channel.

A 3D polygon (like a 3D polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled region. UnlikePolygon3DElement,Polygon3DInteractiveElement receives agmp-click event.

Custom element:
<gmp-polygon-3d-interactive></gmp-polygon-3d-interactive>

This class extendsPolygon3DElement.

This class implementsPolygon3DInteractiveElementOptions.

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

Constructor

Polygon3DInteractiveElement
Polygon3DInteractiveElement([options])
Parameters: 
Creates aPolygon3DInteractiveElement with the options specified.

Properties

Inherited:altitudeMode,drawsOccludedSegments,extruded,fillColor,geodesic,innerCoordinates,outerCoordinates,strokeColor,strokeWidth,zIndex

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

Events

gmp-click
function(clickEvent)
Arguments: 
  • clickEventLocationClickEvent The event object will contain the lat-lng-altitude location of the click.
This event is fired when thePolygon3DInteractiveElement element is clicked.

Polygon3DInteractiveElementOptionsinterface

google.maps.maps3d.Polygon3DInteractiveElementOptionsinterface

Notice: Available only in thev=beta channel.

Polygon3DInteractiveElementOptions object used to define the properties that can be set on a Polygon3DInteractiveElement.

This interface extendsPolygon3DElementOptions.

Properties

Inherited:altitudeMode,drawsOccludedSegments,extruded,fillColor,geodesic,innerCoordinates,outerCoordinates,strokeColor,strokeWidth,zIndex

PopoverElementclass

google.maps.maps3d.PopoverElementclass

Notice: Available only in thev=beta channel.

A custom HTML element that renders a popover. It looks like a bubble and is often connected to a marker.

Custom element:
<gmp-popover altitude-mode="absolute" light-dismiss-disabled open position-anchor="lat,lng"></gmp-popover>

This class extendsHTMLElement.

This class implementsPopoverElementOptions.

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

Constructor

PopoverElement
PopoverElement([options])
Parameters: 

Properties

altitudeMode
Type: AltitudeModeoptional
Specifies how the altitude component of the position is interpreted.
HTML attribute:
  • <gmp-popover altitude-mode="absolute"></gmp-popover>
  • <gmp-popover altitude-mode="clamp-to-ground"></gmp-popover>
  • <gmp-popover altitude-mode="relative-to-ground"></gmp-popover>
  • <gmp-popover altitude-mode="relative-to-mesh"></gmp-popover>
lightDismissDisabled
Type: booleanoptional
Default:false
Specifies whether this popover should be "light dismissed" or not. The "light dismiss" behavior is similar to setting thepopover="auto" attribute which is part of the browserPopover API.
HTML attribute:
  • <gmp-popover light-dismiss-disabled></gmp-popover>
open
Type: booleanoptional
Default:false
Specifies whether this popover should be open or not.
HTML attribute:
  • <gmp-popover open></gmp-popover>
positionAnchor
The position at which to display this popover. If the popover is anchored to an interactive marker, the marker's position will be used instead.
HTML attribute:
  • <gmp-popover position-anchor="lat,lng"></gmp-popover>
  • <gmp-popover position-anchor="lat,lng,altitude"></gmp-popover>
  • <gmp-popover position-anchor="marker-id"></gmp-popover>

Slots

default
Places the slotted content in the main section of the popover.
header
Places the slotted content in the heading section of the popover.

CSS Properties

--gmp-popover-max-width
Maximum width of the popover, regardless of content's width.
--gmp-popover-min-width
Minimum width of the popover, regardless of content's width. When using this property, it is strongly recommended to set it to a value less than the width of the map (in pixels).
--gmp-popover-pixel-offset-x
The offset on the x-axis, in pixels, of the tip of the popover from the point on the map at whose geographical coordinates the popover is anchored.
--gmp-popover-pixel-offset-y
The offset on the y-axis, in pixels, of the tip of the popover from the point on the map at whose geographical coordinates the popover is anchored.
color-scheme
Indicates which color scheme this popover can be rendered in. Seecolor-schemedocumentation for more details. If not specified, it defaults to the user's color scheme preferences.

Methods

BetaaddEventListener

Notice: Available only in thev=beta channel.

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|AddEventListenerOptionsoptional Seeoptions. Custom events only supportcapture andpassive.
Return Value: void
Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener.
BetaremoveEventListener

Notice: Available only in thev=beta channel.

removeEventListener(type, listener[, options])
Parameters: 
Return Value: void
Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener.

PopoverElementOptionsinterface

google.maps.maps3d.PopoverElementOptionsinterface

Notice: Available only in thev=beta channel.

PopoverElementOptions object used to define the properties that can be set on a PopoverElement.

Properties

altitudeModeoptional
Type: AltitudeModeoptional
lightDismissDisabledoptional
Type: booleanoptional
openoptional
Type: booleanoptional
positionAnchoroptional

AltitudeModeconstants

google.maps.maps3d.AltitudeModeconstants

Notice: Available only in thev=beta channel.

Specifies how altitude components in the coordinates are interpreted.

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

Constants

ABSOLUTEAllows to express objects relative to the average mean sea level. That also means that if the terrain level of detail changes underneath the object, its absolute position will remain the same.
CLAMP_TO_GROUNDAllows to express objects placed on the ground. They will remain at ground level following the terrain regardless of what altitude is provided. If the object is positioned over a major body of water, it will be placed at sea level.
RELATIVE_TO_GROUNDAllows to express objects relative to the ground surface. If the terrain level of detail changes, the position of the object will remain constant relative to the ground. When over water, the altitude will be interpreted as a value in meters above sea level.
RELATIVE_TO_MESHAllows to express objects relative to the highest of ground+building+water surface. When over water, this will be water surface; when over terrain, this will be the building surface (if present) or ground surface (if no buildings).

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-07-18 UTC.