Maps

MapElement class

google.maps.MapElement class

MapElement is an HTMLElement subclass for rendering maps. After loading the maps library, a map can be created in HTML. For example:

<gmp-map center="37.4220656,-122.0840897" zoom="10" map-id="DEMO_MAP_ID">
  <button slot="control-block-start-inline-end">Custom Control</button>
</gmp-map>

Internally, it uses Map, which can be accessed with the MapElement.innerMap property.

Custom element:
<gmp-map center="lat,lng" heading-interaction-disabled internal-usage-attribution-ids="id1 id2" map-id="string" rendering-type="vector" tilt-interaction-disabled zoom="number"></gmp-map>

This class extends HTMLElement.

This class implements MapElementOptions.

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

MapElement
MapElement([options])
Parameters: 
center
Type:  LatLng|LatLngLiteral optional
The center latitude/longitude of the map.
HTML attribute:
  • <gmp-map center="lat,lng"></gmp-map>
headingInteractionDisabled
Type:  boolean optional
Default: false
Whether the map should allow user control of the camera heading (rotation). This option is only in effect when the map is a vector map. If not set in code, then the cloud configuration for the map ID will be used (if available).
HTML attribute:
  • <gmp-map heading-interaction-disabled></gmp-map>
innerMap
Type:  Map
A reference to the Map that the MapElement uses internally.
internalUsageAttributionIds
Type: