Image overlays

MapType interface

google.maps.MapType interface

This interface defines the map type, and is typically used for custom map types. Immutable.

maxZoom
Type:number
The maximum zoom level for the map when displaying this MapType. Required for base MapTypes, ignored for overlay MapTypes.
minZoom
Type:number
The minimum zoom level for the map when displaying this MapType. Optional; defaults to 0.
radius
Type:number
Radius of the planet for the map, in meters. Optional; defaults to Earth's equatorial radius of 6378137 meters.
tileSize
Type:Size
The dimensions of each tile. Required.
altoptional
Type:stringoptional
Alt text to display when this MapType's button is hovered over in the MapTypeControl. Optional.
nameoptional
Type:stringoptional
Name to display in the MapTypeControl. Optional.
projectionoptional
Type:Projectionoptional
The Projection used to render this MapType. Optional; defaults to Mercator.
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters:
  • tileCoord:PointTile coordinates.
  • zoom:numberTile zoom.
  • ownerDocument:DocumentThe document which owns this tile.
Return Value:Element|nullResulting tile.
Returns a tile for the given tile coordinate (x, y) and zoom level. This tile will be appended to the given ownerDocument. Not available for base map types.
releaseTile
releaseTile(tile)
Parameters:
  • tile:ElementoptionalTile to release.
Return Value:None
Releases the given tile, performing any necessary cleanup. The provided tile will have already been removed from the document. Optional.

Projection interface

google.maps.Projection interface

fromLatLngToPoint
fromLatLngToPoint(latLng[, point])
Parameters:
Return Value:Point|null
Translates from the LatLng cylinder to the Point plane. This interface specifies a function which implements translation from givenLatLngvalues to world coordinates on the map projection. The Maps API calls this method when it needs to plot locations on screen.Projectionobjects must implement this method, but may returnnullif the projection cannot calculate thePoint.
fromPointToLatLng
fromPointToLatLng(pixel[, noClampNoWrap])
Parameters:
  • pixel:Point
  • noClampNoWrap:booleanoptional
Return Value:LatLng|null
This interface specifies a function which implements translation from world coordinates on a map projection toLatLngvalues. The Maps API calls this method when it needs to translate actions on screen to positions on the map.Projectionobjects must implement this method, but may returnnullif the projection cannot calculate theLatLng.

ImageMapType class

google.maps.ImageMapType class

This class implements the MapType interface and is provided for rendering image tiles.

This class extends MVCObject.

This class implements MapType.

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

ImageMapType
ImageMapType(opts)
Parameters:
Constructs an ImageMapType using the provided ImageMapTypeOptions
alt
Type:stringoptional
maxZoom
Type:number
minZoom
Type:number
name
Type:stringoptional
projection
radius
Type:number
tileSize
Type:Size
getOpacity
getOpacity()
Parameters:None
Return Value:numberopacity The current opacity.
Returns the opacity level (0(transparent) to1.0) of theImageMapTypetiles.
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters:
  • tileCoord:PointTile coordinates.
  • zoom:numberTile zoom.
  • ownerDocument:DocumentThe document which owns this tile.
Return Value:Element|nullResulting tile.
releaseTile
releaseTile(tileDiv)
Parameters:
  • tileDiv:ElementoptionalTile to release.
Return Value:None
setOpacity
setOpacity(opacity)
Parameters:
  • opacity:numberThe new opacity.
Return Value:None
Sets the opacity level (0(transparent) to1.0) of theImageMapTypetiles.
Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll
tilesloaded
function()
Arguments:None
This event is fired when the visible tiles have finished loading.

ImageMapTypeOptions interface

google.maps.ImageMapTypeOptions interface

This class is used to create a MapType that renders image tiles.

altoptional
Type:stringoptional
Alt text to display when this MapType's button is hovered over in the MapTypeControl.
getTileUrloptional
Type:function(Point,number): (stringoptional)optional
Returns a string (URL) for given tile coordinate (x, y) and zoom level.
maxZoomoptional
Type:numberoptional
The maximum zoom level for the map when displaying this MapType.
minZoomoptional
Type:numberoptional
The minimum zoom level for the map when displaying this MapType. Optional.
nameoptional
Type:stringoptional
Name to display in the MapTypeControl.
opacityoptional
Type:numberoptional
The opacity to apply to the tiles. The opacity should be specified as a float value between 0 and 1.0, where 0 is fully transparent and 1 is fully opaque.
tileSizeoptional
Type:Sizeoptional
The tile size.

GroundOverlay class

google.maps.GroundOverlay class

A rectangular image overlay on the map.

This class extends MVCObject.

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

GroundOverlay
GroundOverlay(url, bounds[, opts])
Parameters:
Creates a ground overlay from the provided image URL and itsLatLngBounds.The image is scaled to fit the current bounds, and projected using the current map projection.
getBounds
getBounds()
Parameters:None
Return Value:LatLngBounds
Gets theLatLngBoundsof this overlay.
getMap
getMap()
Parameters:None
Return Value:Map
Returns the map on which this ground overlay is displayed.
getOpacity
getOpacity()
Parameters:None
Return Value:number
Returns the opacity of this ground overlay.
getUrl
getUrl()
Parameters:None
Return Value:string
Gets the url of the projected image.
setMap
setMap(map)
Parameters:
Return Value:None
Renders the ground overlay on the specified map. If map is set tonull,the overlay is removed.
setOpacity
setOpacity(opacity)
Parameters:
  • opacity:number
Return Value:None
Sets the opacity of this ground overlay.
Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll
click
function(event)
Arguments:
This event is fired when the DOM click event is fired on theGroundOverlay.
dblclick
function(event)
Arguments:
This event is fired when the DOM dblclick event is fired on theGroundOverlay.

GroundOverlayOptions interface

google.maps.GroundOverlayOptions interface

This object defines the properties that can be set on aGroundOverlayobject.

clickableoptional
Type:booleanoptional
Iftrue,the ground overlay can receive mouse events.
mapoptional
Type:Mapoptional
The map on which to display the overlay.
opacityoptional
Type:numberoptional
Default:1.0
The opacity of the overlay, expressed as a number between 0 and 1. Optional.

StyledMapType class

google.maps.StyledMapType class

Creates aMapTypewith a custom style.

This class extends MVCObject.

This class implements MapType.

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

StyledMapType
StyledMapType(styles[, options])
Parameters:
Creates a styledMapTypewith the specified options. TheStyledMapTypetakes an array ofMapTypeStyles, where eachMapTypeStyleis applied to the map consecutively. A laterMapTypeStylethat applies the sameMapTypeStylers to the same selectors as an earlierMapTypeStylewill override the earlierMapTypeStyle.
alt
Type:string
maxZoom
Type:number
minZoom
Type:number
name
Type:string
projection
radius
Type:number
tileSize
Type:Size
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters:
  • tileCoord:PointTile coordinates.
  • zoom:numberTile zoom.
  • ownerDocument:DocumentThe document which owns this tile.
Return Value:Element|nullResulting tile.
releaseTile
releaseTile(tile)
Parameters:
  • tile:ElementoptionalTile to release.
Return Value:None
Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll

StyledMapTypeOptions interface

google.maps.StyledMapTypeOptions interface

This class is used to specify options when creating aStyledMapType.These options cannot be changed after theStyledMapTypeis instantiated.

altoptional
Type:stringoptional
Text to display when thisMapType's button is hovered over in the map type control.
maxZoomoptional
Type:numberoptional
The maximum zoom level for the map when displaying thisMapType.Optional.
minZoomoptional
Type:numberoptional
The minimum zoom level for the map when displaying thisMapType.Optional.
nameoptional
Type:stringoptional
The name to display in the map type control.