New pricing changes went into effect on July 16, 2018. For more information, check out the Guide for Existing Users.

Image overlays

MapType interface

google.maps.MapType interface

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

Methods
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters: 
  • tileCoordPoint
  • zoomnumber
  • ownerDocumentDocument
Return Value:  Node
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: 
  • tileNode
Return Value:  None
Releases the given tile, performing any necessary cleanup. The provided tile will have already been removed from the document. Optional.
Properties
alt
Type:  string
Alt text to display when this MapType's button is hovered over in the MapTypeControl. Optional.
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.
name
Type:  string
Name to display in the MapTypeControl. Optional.
projection
Type:  Projection
The Projection used to render this MapType. Optional; defaults to Mercator.
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.

Projection interface

google.maps.Projection interface

Methods
fromLatLngToPoint
fromLatLngToPoint(latLng[, point])
Parameters: 
Return Value:  Point
Translates from the LatLng cylinder to the Point plane. This interface specifies a function which implements translation from given LatLng values to world coordinates on the map projection. The Maps API calls this method when it needs to plot locations on screen. Projection objects must implement this method.
fromPointToLatLng
fromPointToLatLng(pixel[, nowrap])
Parameters: 
  • pixelPoint
  • nowrap (optional):  boolean
Return Value:  LatLng
This interface specifies a function which implements translation from world coordinates on a map projection to LatLng values. The Maps API calls this method when it needs to translate actions on screen to positions on the map. Projection objects must implement this method.

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.

Constructor
ImageMapType
ImageMapType(opts)
Parameters: 
Constructs an ImageMapType using the provided ImageMapTypeOptions
Methods
getOpacity
getOpacity()
Parameters:  None
Return Value:  number
Returns the opacity level (0 (transparent) to 1.0) of the ImageMapType tiles.
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters: 
  • tileCoordPoint
  • zoomnumber
  • ownerDocumentDocument
Return Value:  Node
releaseTile
releaseTile(tileDiv)
Parameters: 
  • tileDivNode
Return Value:  None
setOpacity
setOpacity(opacity)
Parameters: 
  • opacitynumber
Return Value:  None
Sets the opacity level (0 (transparent) to 1.0) of the ImageMapType tiles.
Properties
alt
Type:  string
maxZoom
Type:  number
minZoom
Type:  number
name
Type:  string
projection
Type:  Projection
radius
Type:  number
tileSize
Type:  Size
Events
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.

Properties
alt
Type:  string
Alt text to display when this MapType's button is hovered over in the MapTypeControl.
getTileUrl
Type:  function(Point, number): string
Returns a string (URL) for given tile coordinate (x, y) and zoom level.
maxZoom
Type:  number
The maximum zoom level for the map when displaying this MapType.
minZoom
Type:  number
The minimum zoom level for the map when displaying this MapType. Optional.
name
Type:  string
Name to display in the MapTypeControl.
opacity
Type:  number
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.
tileSize
Type:  Size
The tile size.

GroundOverlay class

google.maps.GroundOverlay class

A rectangular image overlay on the map.

This class extends MVCObject.

Constructor
GroundOverlay
GroundOverlay(url, bounds[, opts])
Parameters: 
Creates a ground overlay from the provided image URL and its LatLngBounds. The image is scaled to fit the current bounds, and projected using the current map projection.
Methods
getBounds
getBounds()
Parameters:  None
Return Value:  LatLngBounds
Gets the LatLngBounds of 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 to null, the overlay is removed.
setOpacity
setOpacity(opacity)
Parameters: 
  • opacitynumber
Return Value:  None
Sets the opacity of this ground overlay.
Events
click
function(event)
Arguments: 
This event is fired when the DOM click event is fired on the GroundOverlay.
dblclick
function(event)
Arguments: 
This event is fired when the DOM dblclick event is fired on the GroundOverlay.

GroundOverlayOptions interface

google.maps.GroundOverlayOptions interface

This object defines the properties that can be set on a GroundOverlay object.

Properties
clickable
Type:  boolean
If true, the ground overlay can receive mouse events.
map
Type:  Map
The map on which to display the overlay.
opacity
Type:  number
The opacity of the overlay, expressed as a number between 0 and 1. Optional. Defaults to 1.

StyledMapType class

google.maps.StyledMapType class

Creates a MapType with a custom style.

This class extends MVCObject.

This class implements MapType.

Constructor
StyledMapType
StyledMapType(styles[, options])
Parameters: 
Creates a styled MapType with the specified options. The StyledMapType takes an array of MapTypeStyles, where each MapTypeStyle is applied to the map consecutively. A later MapTypeStyle that applies the same MapTypeStylers to the same selectors as an earlier MapTypeStyle will override the earlier MapTypeStyle.
Methods
getTile
getTile(tileCoord, zoom, ownerDocument)
Parameters: 
  • tileCoordPoint
  • zoomnumber
  • ownerDocumentDocument
Return Value:  Node
releaseTile
releaseTile(tile)
Parameters: 
  • tileNode
Return Value:  None
Properties
alt
Type:  string
maxZoom
Type:  number
minZoom
Type:  number
name
Type:  string
projection
Type:  Projection
radius
Type:  number
tileSize
Type:  Size

StyledMapTypeOptions interface

google.maps.StyledMapTypeOptions interface

This class is used to specify options when creating a StyledMapType. These options cannot be changed after the StyledMapType is instantiated.

Properties
alt
Type:  string
Text to display when this MapType's button is hovered over in the map type control.
maxZoom
Type:  number
The maximum zoom level for the map when displaying this MapType. Optional.
minZoom
Type:  number
The minimum zoom level for the map when displaying this MapType. Optional.
name
Type:  string
The name to display in the map type control.

Envoyer des commentaires concernant…

Maps JavaScript API
Besoin d'aide ? Consultez notre page d'assistance.