Draw on the map
MarkerElement class
google.maps.maps3d.MarkerElement
class
Shows a position on a 3D map. Note that the position must be set for the MarkerElement to display.
Custom element:
<gmp-marker altitude-mode="absolute" anchor-left="string" anchor-top="string" collision-behavior="required" collision-priority="number" position="lat,lng" title="string"></gmp-marker>
This class extends
HTMLElement.
This class implements
MarkerElementOptions.
Access by calling const {MarkerElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
MarkerElement |
Parameters:
Creates an |
Properties | |
|---|---|
|
Type: Default: Specifies how the altitude component of the position is interpreted. HTML attribute:
|
|
Type: Default: -50% A CSS length-percentage value which is used to offset the anchor point from the top left corner of the marker. This is useful when using a visual which has an anchor point that is different from the typical bottom center point of the default marker. HTML attribute:
|
|
Type: Default: -100% A CSS length-percentage value which is used to offset the anchor point from the top left corner of the marker. This is useful when using a visual which has an anchor point that is different from the typical bottom center point of the default marker. HTML attribute:
|
|
Type: Default: An enumeration specifying how a MarkerElement should behave when it collides with another HTML attribute:
|
|
Type: A number which is used to help determine relative priority between HTML attribute:
|
|
Type: The location of the tip of the marker. Altitude is ignored in certain modes and thus optional. HTML attribute:
|
|
Type: Rollover text. If provided, an accessibility text (e.g. for use with screen readers) will be added to the HTML attribute:
|
Slots | |
|---|---|
|
Any custom elements directly added to the |
CSS Properties | |
|---|---|
|
The z-index of this marker. See |
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
MarkerInteractiveElement class
google.maps.maps3d.MarkerInteractiveElement
class
Shows a position on a 3D map. Note that the position must be set for the MarkerInteractiveElement to display. Unlike MarkerElement, MarkerInteractiveElement receives a gmp-click event.
Custom element:
<gmp-marker-interactive gmp-popover-target="popover-id"></gmp-marker-interactive>
This class extends
MarkerElement.
This class implements
MarkerInteractiveElementOptions.
Access by calling const {MarkerInteractiveElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
MarkerInteractiveElement |
Parameters:
Creates a |
Properties | |
|---|---|
|
Type: When set, the popover element will be open on this marker's click. HTML attribute:
|
Inherited:
,
,
,
,
,
,
| |
Slots | |
|---|---|
Inherited:
|
CSS Properties | |
|---|---|
Inherited:
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
|
Arguments:
This event is fired when the |
Marker3DElement class
google.maps.maps3d.Marker3DElement
class
Shows a position on a 3D map. Note that the position must be set for the Marker3DElement to display.
Custom element:
<gmp-marker-3d altitude-mode="absolute" collision-behavior="required" collision-priority="number" draws-when-occluded extruded label="string" position="lat,lng" size-preserved z-index="number"></gmp-marker-3d>
This class extends
HTMLElement.
This class implements
Marker3DElementOptions.
Access by calling const {Marker3DElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Marker3DElement |
Parameters:
Creates an |
Properties | |
|---|---|
altitudeMode |
Type: Default: Specifies how the altitude component of the position is interpreted. HTML attribute:
|
collisionBehavior |
Type: Default: An enumeration specifying how a Marker3DElement should behave when it collides with another Marker3DElement or with the basemap labels. HTML attribute:
|
|
Type: The collision priority used for collision detection. HTML attribute:
|
drawsWhenOccluded |
Type: Default: 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:
|
extruded |
Type: Default: Specifies whether to connect the marker to the ground. To extrude a marker, the HTML attribute:
|
label |
Type: Text to be displayed by this marker. HTML attribute:
|
position |
Type: The location of the tip of the marker. Altitude is ignored in certain modes and thus optional. HTML attribute:
|
sizePreserved |
Type: Default: 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:
|
zIndex |
Type: The zIndex compared to other markers. HTML attribute:
|
Slots | |
|---|---|
default |
Any custom elements directly added to the 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 | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Marker3DInteractiveElement class
google.maps.maps3d.Marker3DInteractiveElement
class
Shows a position on a 3D map. Note that the position must be set for the Marker3DInteractiveElement to display. Unlike Marker3DElement, Marker3DInteractiveElement receives a gmp-click event.
Custom element:
<gmp-marker-3d-interactive gmp-popover-target="popover-id" title="string"></gmp-marker-3d-interactive>
This class extends
Marker3DElement.
This class implements
Marker3DInteractiveElementOptions.
Access by calling const {Marker3DInteractiveElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Marker3DInteractiveElement |
Parameters:
Creates an |
Properties | |
|---|---|
gmpPopoverTargetElement |
Type: When set, the popover element will be open on this marker's click. HTML attribute:
|
title |
Type: Rollover text. If provided, an accessibility text (e.g. for use with screen readers) will be added to the HTML attribute:
|
Inherited:
altitudeMode,
collisionBehavior,
,
drawsWhenOccluded,
extruded,
label,
position,
sizePreserved,
zIndex
| |
Slots | |
|---|---|
default |
Any custom elements directly added to the |
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
gmp-click |
Arguments:
This event is fired when the |
Model3DElement class
google.maps.maps3d.Model3DElement
class
A 3D model which allows the rendering of gLTF models. Note that the position and the src must be set for the Model3DElement to display.
Core properties of the gLTF 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 extends
HTMLElement.
This class implements
Model3DElementOptions.
Access by calling const {Model3DElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Model3DElement |
Parameters:
Creates an |
Properties | |
|---|---|
altitudeMode |
Type: Default: Specifies how altitude in the position is interpreted. HTML attribute:
|
orientation |
Type: 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:
|
position |
Type: Sets the HTML attribute:
|
scale |
Type: Default: Scales the model along the x, y, and z axes in the model's coordinate space. HTML attribute:
|
src |
Type: Specifies the url of the 3D model. At this time, only models in the Any relative HTTP urls will be resolved to their corresponding absolute ones. Please note that If you're hosting your HTML attribute:
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Model3DInteractiveElement class
google.maps.maps3d.Model3DInteractiveElement
class
A 3D model which allows the rendering of gLTF models. Note that the position and the src must be set for the Model3DElement to display.
Core properties of the gLTF PBR should be supported. No extensions or extension properties are currently supported.
Unlike Model3DElement, Model3DInteractiveElement receives a gmp-click event.
Custom element:
<gmp-model-3d-interactive></gmp-model-3d-interactive>
This class extends
Model3DElement.
This class implements
Model3DInteractiveElementOptions.
Access by calling const {Model3DInteractiveElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Model3DInteractiveElement |
Parameters:
Creates a |
Properties | |
|---|---|
Inherited:
altitudeMode,
orientation,
position,
scale,
src
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
gmp-click |
Arguments:
This event is fired when the |
Polyline3DElement class
google.maps.maps3d.Polyline3DElement
class
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" path="lat1,lng1,altitude1 lat2,lng2,altitude2 lat3,lng3,altitude3 ..." stroke-color="string" stroke-width="number" z-index="number"></gmp-polyline-3d>
This class extends
HTMLElement.
This class implements
Polyline3DElementOptions.
Access by calling const {Polyline3DElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Polyline3DElement |
Parameters:
Creates an |
Properties | |
|---|---|
altitudeMode |
Type: Default: Specifies how altitude components in the coordinates are interpreted. HTML attribute:
|
drawsOccludedSegments |
Type: Default: 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:
|
extruded |
Type: Default: Specifies whether to connect the polyline to the ground. To extrude a polyline, the HTML attribute:
|
geodesic |
Type: Default: When HTML attribute:
|
outerColor |
Type: The outer color. All CSS3 colors are supported. HTML attribute:
|
outerWidth |
Type: The outer width is between HTML attribute:
|
path |
Type: The ordered sequence of coordinates of the Polyline. Altitude is ignored in certain modes and thus optional. HTML attribute:
|
strokeColor |
Type: The stroke color. All CSS3 colors are supported. HTML attribute:
|
strokeWidth |
Type: The stroke width in pixels. HTML attribute:
|
zIndex |
Type: The zIndex compared to other polys. HTML attribute:
|
|
Type: The ordered sequence of coordinates of the Polyline. Altitude is ignored in certain modes and thus optional. |
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Polyline3DInteractiveElement class
google.maps.maps3d.Polyline3DInteractiveElement
class
A 3D polyline is a linear overlay of connected line segments on a 3D map. Unlike Polyline3DElement, Polyline3DInteractiveElement receives a gmp-click event.
Custom element:
<gmp-polyline-3d-interactive></gmp-polyline-3d-interactive>
This class extends
Polyline3DElement.
This class implements
Polyline3DInteractiveElementOptions.
Access by calling const {Polyline3DInteractiveElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Polyline3DInteractiveElement |
Parameters:
Creates a |
Properties | |
|---|---|
Inherited:
altitudeMode,
drawsOccludedSegments,
extruded,
geodesic,
outerColor,
outerWidth,
path,
strokeColor,
strokeWidth,
zIndex,
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
gmp-click |
Arguments:
This event is fired when the |
Polygon3DElement class
google.maps.maps3d.Polygon3DElement
class
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 path="lat1,lng1,altitude1 lat2,lng2,altitude2 lat3,lng3,altitude3 ..." stroke-color="string" stroke-width="number" z-index="number"></gmp-polygon-3d>
This class extends
HTMLElement.
This class implements
Polygon3DElementOptions.
Access by calling const {Polygon3DElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Polygon3DElement |
Parameters:
Creates an |
Properties | |
|---|---|
altitudeMode |
Type: Default: Specifies how altitude components in the coordinates are interpreted. HTML attribute:
|
drawsOccludedSegments |
Type: Default: 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:
|
extruded |
Type: Default: Specifies whether to connect the polygon to the ground. To extrude a polygon, the HTML attribute:
|
fillColor |
Type: The fill color. All CSS3 colors are supported. HTML attribute:
|
geodesic |
Type: Default: When HTML attribute:
|
innerPaths |
Type: 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. |
path |
Type: The ordered sequence of coordinates that designates a closed loop. Altitude is ignored in certain modes and thus optional. HTML attribute:
|
strokeColor |
Type: The stroke color. All CSS3 colors are supported. HTML attribute:
|
strokeWidth |
Type: The stroke width in pixels. HTML attribute:
|
zIndex |
Type: The zIndex compared to other polys. HTML attribute:
|
|
Type: The ordered sequence of coordinates that designates a closed loop. Altitude is ignored in certain modes and thus optional. |
|
Type: 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. |
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Polygon3DInteractiveElement class
google.maps.maps3d.Polygon3DInteractiveElement
class
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. Unlike Polygon3DElement, Polygon3DInteractiveElement receives a gmp-click event.
Custom element:
<gmp-polygon-3d-interactive></gmp-polygon-3d-interactive>
This class extends
Polygon3DElement.
This class implements
Polygon3DInteractiveElementOptions.
Access by calling const {Polygon3DInteractiveElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
Polygon3DInteractiveElement |
Parameters:
Creates a |
Properties | |
|---|---|
Inherited:
altitudeMode,
drawsOccludedSegments,
extruded,
fillColor,
geodesic,
innerPaths,
path,
strokeColor,
strokeWidth,
zIndex,
,
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
gmp-click |
Arguments:
This event is fired when the |
FlattenerElement class
google.maps.maps3d.FlattenerElement
class
A flattener element is used to flatten a specified area on the map.
Custom element:
<gmp-flattener path="lat1,lng1,altitude1 lat2,lng2,altitude2 lat3,lng3,altitude3 ..."></gmp-flattener>
This class extends
HTMLElement.
This class implements
FlattenerElementOptions.
Access by calling const {FlattenerElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
FlattenerElement |
Parameters:
|
Properties | |
|---|---|
|
Type: The ordered sequence of coordinates that designates a closed loop. These paths define Exclusion Holes within the polygon's main path, which is the Flattening Zone. Areas within an innerPath are exempt from flattening. |
|
Type: The ordered sequence of coordinates that designates a closed loop. This loop defines the Flattening Zone. HTML attribute:
|
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
PopoverElement class
google.maps.maps3d.PopoverElement
class
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" auto-pan-disabled light-dismiss-disabled open position-anchor="lat,lng"></gmp-popover>
This class extends
HTMLElement.
This class implements
PopoverElementOptions.
Access by calling const {PopoverElement} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
PopoverElement |
Parameters:
|
Properties | |
|---|---|
altitudeMode |
Type: Default: Specifies how the altitude component of the position is interpreted. HTML attribute:
|
autoPanDisabled |
Type: Default: If set to true, disables panning the map to make the popover fully visible when it opens. HTML attribute:
|
lightDismissDisabled |
Type: Default: Specifies whether this popover should be "light dismissed" or not. The "light dismiss" behavior is similar to setting the HTML attribute:
|
open |
Type: Default: Specifies whether this popover should be open or not. HTML attribute:
|
positionAnchor |
Type: 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:
|
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. |
background-color |
The background color of the popover. See |
border-radius |
The border-radius of the popover. See |
box-shadow |
The box-shadow of the popover. See |
color-scheme |
Indicates which color scheme this popover can be rendered in. See |
padding |
The padding of the popover. See |
Methods | |
|---|---|
addEventListener |
Parameters:
Return Value: Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener. |
removeEventListener |
Parameters:
Return Value: Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
AltitudeMode constants
google.maps.maps3d.AltitudeMode
constants
Specifies how altitude components in the coordinates are interpreted.
Access by calling const {AltitudeMode} = await google.maps.importLibrary("maps3d").
See Libraries in the Maps JavaScript API.
Constants | |
|---|---|
ABSOLUTE |
Allows 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_GROUND |
Allows 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_GROUND |
Allows 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_MESH |
Allows 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). |