Google Maps JavaScript API V3 Reference

Release Version

Last updated Tuesday, November 15, 2016

This reference documents version 3.26 (the release
version) of the Maps Javascript API released November 15, 2016. This release
version of the API is a feature-stable version of the API whose interfaces
are guaranteed to remain as documented within these pages until this
version is retired.

Returns the lat/lng bounds of the current viewport. If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. If the map is not yet initialized (i.e. the mapType is still null), or center and zoom have not been set then the result is null or undefined.

Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView(). Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.

getTilt()

Return Value:number

Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. The result will be 0 for imagery taken directly overhead or 45 for 45° imagery. 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: This method does not return the value set by setTilt. See setTilt for details.

getZoom()

Return Value:number

panBy(x:number, y:number)

Return Value:None

Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).

Pans the map by the minimum amount necessary to contain the given LatLngBounds. It makes no guarantee where on the map the bounds will be, except that as much of the bounds as possible will be visible. The bounds will be positioned inside the area bounded by the map type and navigation (pan, zoom, and Street View) controls, if they are present on the map. If the bounds is larger than the map, the map will be shifted to include the northwest corner of the bounds. If the change in the map's position is less than both the width and height of the map, the transition will be smoothly animated.

Binds a StreetViewPanorama to the map. This panorama overrides the default StreetViewPanorama, allowing the map to bind to an external panorama outside of the map. Setting the panorama to null binds the default embedded panorama back to the map.

setTilt(tilt:number)

Return Value:None

Controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45. setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(45) causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note:getTilt returns the current tilt angle, not the value set by setTilt. Because getTilt and setTilt refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.

This event is fired when the user clicks on the map. An ApiMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a placeid is returned. IconMouseEvent and ApiMouseEvent are identical, except that IconMouseEvent has the placeid field. The event can always be treated as an ApiMouseEvent when the placeid is not important. The click event is not fired if a marker or infowindow was clicked.

When false, map icons are not clickable. A map icon represents a point of interest, also known as a POI. By default map icons are clickable.

disableDefaultUI

Type:boolean

Enables/disables all default UI. May be overridden individually.

disableDoubleClickZoom

Type:boolean

Enables/disables zoom and center on double click. Enabled by default.

draggable

Type:boolean

If false, prevents the map from being dragged. Dragging is enabled by default.

draggableCursor

Type:string

The name or url of the cursor to display when mousing over a draggable map. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggableCursor: 'url(http://www.example.com/icon.png), auto;'.

draggingCursor

Type:string

The name or url of the cursor to display when the map is being dragged. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggingCursor: 'url(http://www.example.com/icon.png), auto;'.

The maximum zoom level which will be displayed on the map. If omitted, or set to null, the maximum zoom from the current map type is used instead. Valid values: Integers between zero, and up to the supported maximum zoom level.

minZoom

Type:number

The minimum zoom level which will be displayed on the map. If omitted, or set to null, the minimum zoom from the current map type is used instead. Valid values: Integers between zero, and up to the supported maximum zoom level.

noClear

Type:boolean

If true, do not clear the contents of the Map div.

panControl

Type:boolean

The enabled/disabled state of the Pan control.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls.

Note: The Pan control is not available in the new set of controls introduced in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you can choose to use the earlier set of controls rather than the new controls, thus making the Pan control available as part of the old control set. See What's New in the v3.22 Map Controls.

If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.

signInControl

Type:boolean

The enabled/disabled state of the sign in control. This option only applies if signed_in=true has been passed as a URL parameter in the bootstrap request. You may want to use this option to hide the map's sign in control if you have provided another way for your users to sign in, such as the Google Sign-In button. This option does not affect the visibility of the Google avatar shown when the user is already signed in.

A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped.

streetViewControl

Type:boolean

The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (e.g. a non-Earth map type).

Styles to apply to each of the default map types. Note that for satellite/hybrid and terrain modes, these styles will only apply to labels and geometry.

tilt

Type:number

Controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45. The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note:getTilt returns the current tilt angle, not the value specified by this option. Because getTilt and this option refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.

zoom

Type:number

The initial Map zoom level. Required. Valid values: Integers between zero, and up to the supported maximum zoom level.

StreetViewControlOptions
object specification

Position id. Used to specify the position of the control on the map. The default position is embedded within the navigation (zoom and pan) controls. If this position is empty or the same as that specified in the zoomControlOptions or panControlOptions, the Street View control will be displayed as part of the navigation controls. Otherwise, it will be displayed separately.

ZoomControlOptions
object specification

Position id. Used to specify the position of the control on the map. The default position is TOP_LEFT.

ControlPosition
constants

google.maps.ControlPosition
constants

Identifiers used to specify the placement of controls on the map. Controls are positioned relative to other controls in the same layout position. Controls that are added first are positioned closer to the edge of the map. +----------------+ + TL TC TR + + LT RT + + + + LC RC + + + + LB RB + + BL BC BR + +----------------+ Elements in the top or bottom row flow towards the middle of the row. Elements in the left or right column flow towards the middle of the column.

Constant

BOTTOM_CENTER

Elements are positioned in the center of the bottom row.

BOTTOM_LEFT

Elements are positioned in the bottom left and flow towards the middle. Elements are positioned to the right of the Google logo.

BOTTOM_RIGHT

Elements are positioned in the bottom right and flow towards the middle. Elements are positioned to the left of the copyrights.

LEFT_BOTTOM

Elements are positioned on the left, above bottom-left elements, and flow upwards.

LEFT_CENTER

Elements are positioned in the center of the left side.

LEFT_TOP

Elements are positioned on the left, below top-left elements, and flow downwards.

RIGHT_BOTTOM

Elements are positioned on the right, above bottom-right elements, and flow upwards.

RIGHT_CENTER

Elements are positioned in the center of the right side.

RIGHT_TOP

Elements are positioned on the right, below top-right elements, and flow downwards.

TOP_CENTER

Elements are positioned in the center of the top row.

TOP_LEFT

Elements are positioned in the top left and flow towards the middle.

TOP_RIGHT

Elements are positioned in the top right and flow towards the middle.

Data
class

google.maps.Data
class

A layer for displaying geospatial data. Points, line-strings and polygons can be displayed.

Every Map has a Data object by default, so most of the time there is no need to construct one. For example:

If the feature has an ID, it will replace any existing feature in the collection with the same ID. If no feature is given, a new feature will be created with null geometry and no properties. If FeatureOptions are given, a new feature will be created with the specified properties.

Note that the IDs 1234 and '1234' are equivalent. Adding a feature with ID 1234 will replace a feature with ID '1234', and vice versa.

Returns which drawing modes are available for the user to select, in the order they are displayed. This does not include the null drawing mode, which is added by default. Possible drawing modes are "Point", "LineString" or "Polygon".

getDrawingMode()

Return Value:string

Returns the current drawing mode of the given Data layer. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything. Possible drawing modes are null, "Point", "LineString" or "Polygon".

Sets which drawing modes are available for the user to select, in the order they are displayed. This should not include the null drawing mode, which is added by default. If null, drawing controls are disabled and not displayed. Possible drawing modes are "Point", "LineString" or "Polygon".

setDrawingMode(drawingMode:string)

Return Value:None

Sets the current drawing mode of the given Data layer. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything. Possible drawing modes are null, "Point", "LineString" or "Polygon".

Data.DataOptions
object specification

The position of the drawing controls on the map. The default position is TOP_LEFT.

controls

Type:Array<string>

Describes which drawing modes are available for the user to select, in the order they are displayed. This should not include the null drawing mode, which is added by default. If null, drawing controls are disabled and not displayed. Defaults to null. Possible drawing modes are "Point", "LineString" or "Polygon".

drawingMode

Type:string

The current drawing mode of the given Data layer. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything. Defaults to null. Possible drawing modes are null, "Point", "LineString" or "Polygon".

When drawing is enabled and a user draws a Geometry (a Point, Line String or Polygon), this function is called with that Geometry and should return a Feature that is to be added to the Data layer. If a featureFactory is not supplied, a Feature with no id and no properties will be created from that Geometry instead. Defaults to null.

Defines the image map used for hit detection. Only applies to point geometries.

strokeColor

Type:string

The stroke color. All CSS3 colors are supported except for extended named colors. Only applies to line and polygon geometries.

strokeOpacity

Type:number

The stroke opacity between 0.0 and 1.0. Only applies to line and polygon geometries.

strokeWeight

Type:number

The stroke width in pixels. Only applies to line and polygon geometries.

title

Type:string

Rollover text. Only applies to point geometries.

visible

Type:boolean

Whether the feature is visible. Defaults to true.

zIndex

Type:number

All features are displayed on the map in order of their zIndex, with higher values displaying in front of features with lower values. Markers are always displayed in front of line-strings and polygons.

Data.StylingFunction
typedef

google.maps.Data.StylingFunction
typedef

A function that computes the appearance of a feature.

The Data.setStyle() method can accept a styling function. Use
this when features should appear differently depending on their properties.
You can find more information about styling features in the developer's
guide.

Data.FeatureOptions
object specification

The feature geometry. If none is specified when a feature is constructed, the feature's geometry will be null. If a LatLng object or LatLngLiteral is given, this will be converted to a Data.Point geometry.

id

Type:number|string

Feature ID is optional. If provided, it can be used to look up the feature in a Data object using the getFeatureById() method. Note that a feature's ID cannot be subsequently changed.

properties

Type:Object

The feature properties. This is an arbitrary mapping of property names to values.

Data.Polygon
class

google.maps.Data.Polygon
class

A Polygon geometry contains a number of Data.LinearRings. The first linear-ring must be the polygon exterior boundary and subsequent linear-rings must be interior boundaries, also known as holes. See the sample polygon with a hole.

Contains all the information needed to identify your application as the source of a save. In this context, 'place' means a business, point of interest or geographic location. attribution must be specified with a place in order to enable a save.

Note: The signed-in maps feature is deprecated. Versions 3.27 and earlier of the Google Maps JavaScript API continue to support signed-in maps. A future version will no longer support signed-in maps, and will not support the attribution property to save a place.

clickable

Type:boolean

If true, the marker receives mouse and touch events. Default value is true.

crossOnDrag

Type:boolean

If false, disables cross that appears beneath the marker when dragging. This option is true by default.

Optimization renders many markers as a single static element. Optimized rendering is enabled by default. Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element (advanced usage only).

Place information, used to identify and describe the place associated with this Marker. In this context, 'place' means a business, point of interest or geographic location. To allow a user to save this place, open an info window anchored on this marker. The info window will contain information about the place and an option for the user to save it. Only one of position or place can be specified.

Note: The signed-in maps feature is deprecated. Versions 3.27 and earlier of the Google Maps JavaScript API continue to support signed-in maps. A future version will no longer support signed-in maps, and will not support saving a place directly from within your application. Read more about signed-in maps.

All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen.

The display size of the sprite or image. When using sprites, you must specify the sprite size. If the size is not provided, it will be set when the image loads.

url

Type:string

The URL of the image or sprite sheet.

MarkerLabel
object specification

google.maps.MarkerLabel
object specification

These options specify the appearance of a marker label. A marker label is a single character of text which will appear inside the marker. If you are using it with a custom marker, you can reposition it with the labelOrigin property in the Icon class.

Properties

color

Type:string

The color of the label text. Default color is black.

fontFamily

Type:string

The font family of the label text (equivalent to the CSS font-family property).

fontSize

Type:string

The font size of the label text (equivalent to the CSS font-size property). Default size is 14px.

fontWeight

Type:string

The font weight of the label text (equivalent to the CSS font-weight property).

text

Type:string

The text to be displayed in the label.

MarkerShape
object specification

google.maps.MarkerShape
object specification

This object defines the clickable region of a marker image for browsers other than Internet Explorer. The shape consists of two properties — type and coord — which define the non-transparent region of an image. A MarkerShape object is not required on Internet Explorer since the browser does not fire events on the transparent region of an image by default.

Properties

coords

Type:Array<number>

The format of this attribute depends on the value of the type and follows the w3 AREA coords specification found at http://www.w3.org/TR/REC-html40/struct/objects.html#adef-coords. The coords attribute is an array of integers that specify the pixel position of the shape relative to the top-left corner of the target image. The coordinates depend on the value of type as follows: - circle: coords is [x1,y1,r] where x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle. - poly: coords is [x1,y1,x2,y2...xn,yn] where each x,y pair contains the coordinates of one vertex of the polygon. - rect: coords is [x1,y1,x2,y2] where x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.

type

Type:string

Describes the shape's type and can be circle, poly or rect.

Symbol
object specification

The position of the symbol relative to the marker or polyline. The coordinates of the symbol's path are translated left and up by the anchor's x and y coordinates respectively. By default, a symbol is anchored at (0, 0). The position is expressed in the same coordinate system as the symbol's path.

fillColor

Type:string

The symbol's fill color. All CSS3 colors are supported except for extended named colors. For symbol markers, this defaults to 'black'. For symbols on polylines, this defaults to the stroke color of the corresponding polyline.

The origin of the label relative to the origin of the path, if label is supplied by the marker. By default, the origin is located at (0, 0). The origin is expressed in the same coordinate system as the symbol's path. This property is unused for symbols on polylines.

The symbol's path, which is a built-in symbol path, or a custom path expressed using SVG path notation. Required.

rotation

Type:number

The angle by which to rotate the symbol, expressed clockwise in degrees. Defaults to 0. A symbol in an IconSequence where fixedRotation is false is rotated relative to the angle of the edge on which it lies.

scale

Type:number

The amount by which the symbol is scaled in size. For symbol markers, this defaults to 1; after scaling, the symbol may be of any size. For symbols on a polyline, this defaults to the stroke weight of the polyline; after scaling, the symbol must lie inside a square 22 pixels in size centered at the symbol's anchor.

strokeColor

Type:string

The symbol's stroke color. All CSS3 colors are supported except for extended named colors. For symbol markers, this defaults to 'black'. For symbols on a polyline, this defaults to the stroke color of the polyline.

strokeOpacity

Type:number

The symbol's stroke opacity. For symbol markers, this defaults to 1. For symbols on a polyline, this defaults to the stroke opacity of the polyline.

strokeWeight

Type:number

The symbol's stroke weight. Defaults to the scale of the symbol.

SymbolPath
constants

google.maps.SymbolPath
constants

Built-in symbol paths.

Constant

BACKWARD_CLOSED_ARROW

A backward-pointing closed arrow.

BACKWARD_OPEN_ARROW

A backward-pointing open arrow.

CIRCLE

A circle.

FORWARD_CLOSED_ARROW

A forward-pointing closed arrow.

FORWARD_OPEN_ARROW

A forward-pointing open arrow.

Animation
constants

google.maps.Animation
constants

Animations that can be played on a marker. Use the setAnimation method on Marker or the animation option to play an animation.

Constant

BOUNCE

Marker bounces until animation is stopped.

DROP

Marker falls from the top of the map ending with a small bounce.

InfoWindow
class

google.maps.InfoWindow
class

An overlay that looks like a bubble and is often connected to a marker.

Creates an info window with the given options. An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. After constructing an InfoWindow, you must call open to display it on the map. The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect.

Opens this InfoWindow on the given map. Optionally, an InfoWindow can be associated with an anchor. In the core API, the only anchor is the Marker class. However, an anchor can be any MVCObject that exposes a LatLng position property and optionally a Point anchorPoint property for calculating the pixelOffset (see InfoWindowOptions). The anchorPoint is the offset from the anchor's position to the tip of the InfoWindow.

This event is fired when the <div> containing the InfoWindow's content is attached to the DOM. You may wish to monitor this event if you are building out your info window content dynamically.

position_changed

Arguments:None

This event is fired when the position property changes.

zindex_changed

Arguments:None

This event is fired when the InfoWindow's zIndex changes.

InfoWindowOptions
object specification

google.maps.InfoWindowOptions
object specification

Properties

content

Type:string|Node

Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size.

disableAutoPan

Type:boolean

Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens.

maxWidth

Type:number

Maximum width of the infowindow, regardless of content's width. This value is only considered if it is set before a call to open. To change the maximum width when changing content, call close, setOptions, and then open.

The offset, in pixels, of the tip of the info window from the point on the map at whose geographical coordinates the info window is anchored. If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the anchor's anchorPoint property.

The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead.

zIndex

Type:number

All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWindows are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers.

Polyline
class

Create a polyline using the passed PolylineOptions, which specify both the path of the polyline and the stroke style to use when drawing the polyline. You may pass either an array of LatLngs or an MVCArray of LatLngs when constructing a polyline, though simple arrays are converted to MVCArrays within the polyline upon instantiation.

PolylineOptions
object specification

If set to true, the user can drag this shape over the map. The geodesic property defines the mode of dragging. Defaults to false.

editable

Type:boolean

If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment. Defaults to false.

geodesic

Type:boolean

When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space. Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. Defaults to false.

The ordered sequence of coordinates of the Polyline. This path may be specified using either a simple array of LatLngs, or an MVCArray of LatLngs. Note that if you pass a simple array, it will be converted to an MVCArray Inserting or removing LatLngs in the MVCArray will automatically update the polyline on the map.

strokeColor

Type:string

The stroke color. All CSS3 colors are supported except for extended named colors.

strokeOpacity

Type:number

The stroke opacity between 0.0 and 1.0.

strokeWeight

Type:number

The stroke width in pixels.

visible

Type:boolean

Whether this polyline is visible on the map. Defaults to true.

zIndex

Type:number

The zIndex compared to other polys.

IconSequence
object specification

google.maps.IconSequence
object specification

Describes how icons are to be rendered on a line.

If your polyline is geodesic, then the distances specified for both offset and repeat are calculated in meters by default. Setting either offset or repeat to a pixel value will cause the distances to be calculated in pixels on the screen.

Properties

fixedRotation

Type:boolean

If true, each icon in the sequence has the same fixed rotation regardless of the angle of the edge on which it lies. Defaults to false, in which case each icon in the sequence is rotated to align with its edge.

The distance from the start of the line at which an icon is to be rendered. This distance may be expressed as a percentage of line's length (e.g. '50%') or in pixels (e.g. '50px'). Defaults to '100%'.

repeat

Type:string

The distance between consecutive icons on the line. This distance may be expressed as a percentage of the line's length (e.g. '50%') or in pixels (e.g. '50px'). To disable repeating of the icon, specify '0'. Defaults to '0'.

Polygon
class

google.maps.Polygon
class

A polygon (like a polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled region. See the samples in the developer's guide, starting with a simple polygon, a polygon with a hole, and more. Note that you can also use the Data layer to create a polygon. The Data layer offers a simpler way of creating holes because it handles the order of the inner and outer paths for you.

Create a polygon using the passed PolygonOptions, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions. A polygon may contain one or more paths, where each path consists of an array of LatLngs. You may pass either an array of LatLngs or an MVCArray of LatLngs when constructing these paths. Arrays are converted to MVCArrays within the polygon upon instantiation.

PolygonOptions
object specification

If set to true, the user can drag this shape over the map. The geodesic property defines the mode of dragging. Defaults to false.

editable

Type:boolean

If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment. Defaults to false.

fillColor

Type:string

The fill color. All CSS3 colors are supported except for extended named colors.

fillOpacity

Type:number

The fill opacity between 0.0 and 1.0

geodesic

Type:boolean

When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space. Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. Defaults to false.

The ordered sequence of coordinates that designates a closed loop. Unlike polylines, a polygon may consist of one or more paths. As a result, the paths property may specify one or more arrays of LatLng coordinates. Paths are closed automatically; do not repeat the first vertex of the path as the last vertex. Simple polygons may be defined using a single array of LatLngs. More complex polygons may specify an array of arrays. Any simple arrays are converted into MVCArrays. Inserting or removing LatLngs from the MVCArray will automatically update the polygon on the map.

strokeColor

Type:string

The stroke color. All CSS3 colors are supported except for extended named colors.

PolyMouseEvent
object specification

The index of the edge within the path beneath the cursor when the event occurred, if the event occurred on a mid-point on an editable polygon.

path

Type:number

The index of the path beneath the cursor when the event occurred, if the event occurred on a vertex and the polygon is editable. Otherwise undefined.

vertex

Type:number

The index of the vertex beneath the cursor when the event occurred, if the event occurred on a vertex and the polyline or polygon is editable. If the event does not occur on a vertex, the value is undefined.

The opacity of the overlay, expressed as a number between 0 and 1. Optional. Defaults to 1.

OverlayView
class

google.maps.OverlayView
class

You can implement this class if you want to display custom types of overlay objects on the map.

Inherit from this class by setting your overlay's prototype: MyOverlay.prototype = new google.maps.OverlayView();. The OverlayView constructor is guaranteed to be an empty function.

You must implement three methods: onAdd(), draw(), and onRemove().

In the onAdd() method, you should create DOM objects and append them as children of the panes.

In the draw() method, you should position these elements.

In the onRemove() method, you should remove the objects from the DOM.

You must call setMap() with a valid Map object to trigger the call to the onAdd() method and setMap(null) in order to trigger the onRemove() method. The setMap() method can be called at the time of construction or at any point afterward when the overlay should be re-shown after removing. The draw() method will then be called whenever a map property changes that could change the position of the element, such as zoom, center, or map type.

Implement this method to draw or update the overlay. This method is called after onAdd() and when the position from projection.fromLatLngToPixel() would return a new value for a given LatLng. This can happen on change of zoom, center, or map type. It is not necessarily called on drag or resize.

Components are used to restrict results to a specific area. A filter consists of one or more of: route, locality, administrativeArea, postalCode, country. Only the results that match all the filters will be returned. Filter values support the same methods of spelling correction and partial matching as other geocoding requests. Optional.

LatLng (or LatLngLiteral) for which to search. The geocoder performs a reverse geocode. See Reverse Geocoding for more information. One, and only one, of address, location and placeId must be supplied.

placeId

Type:string

The place ID associated with the location. Place IDs uniquely identify a place in the Google Places database and on Google Maps. Learn more about place IDs in the Places API developer guide. The geocoder performs a reverse geocode. See Reverse Geocoding for more information. One, and only one, of address, location and placeId must be supplied.

region

Type:string

Country code used to bias the search, specified as a Unicode region subtag / CLDR identifier. Optional.

GeocoderComponentRestrictions
object specification

google.maps.GeocoderComponentRestrictions
object specification

GeocoderComponentRestrictions represents a set of filters that resolve to a specific area. For details on how this works, see Geocoding Component Filtering.

Properties

administrativeArea

Type:string

Matches all the administrative_area levels. Optional.

country

Type:string

Matches a country name or a two letter ISO 3166-1 country code. Optional.

locality

Type:string

Matches against both locality and sublocality types. Optional.

postalCode

Type:string

Matches postal_code and postal_code_prefix. Optional.

route

Type:string

Matches the long or short name of a route. Optional.

GeocoderStatus
constants

google.maps.GeocoderStatus
constants

The status returned by the Geocoder on the completion of a call to geocode(). Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.GeocoderStatus.OK.

Constant

ERROR

There was a problem contacting the Google servers.

INVALID_REQUEST

This GeocoderRequest was invalid.

OK

The response contains a valid GeocoderResponse.

OVER_QUERY_LIMIT

The webpage has gone over the requests limit in too short a period of time.

REQUEST_DENIED

The webpage is not allowed to use the geocoder.

UNKNOWN_ERROR

A geocoding request could not be processed due to a server error. The request may succeed if you try again.

ZERO_RESULTS

No result was found for this GeocoderRequest.

GeocoderResult
object specification

google.maps.GeocoderResult
object specification

A single geocoder result retrieved from the geocode server. A geocode request may return multiple result objects. Note that though this result is "JSON-like," it is not strictly JSON, as it indirectly includes a LatLng object.

The bounds of the recommended viewport for displaying this GeocoderResult

GeocoderLocationType
constants

google.maps.GeocoderLocationType
constants

Describes the type of location returned from a geocode. Specify these by value, or by using the constant's name. For example, 'ROOFTOP' or google.maps.GeocoderLocationType.ROOFTOP.

Constant

APPROXIMATE

The returned result is approximate.

GEOMETRIC_CENTER

The returned result is the geometric center of a result such a line (e.g. street) or polygon (region).

RANGE_INTERPOLATED

The returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.

DirectionsRendererOptions
object specification

The directions to display on the map and/or in a <div> panel, retrieved as a DirectionsResult object from DirectionsService.

draggable

Type:boolean

If true, allows the user to drag and modify the paths of routes rendered by this DirectionsRenderer.

hideRouteList

Type:boolean

This property indicates whether the renderer should provide UI to select amongst alternative routes. By default, this flag is false and a user-selectable list of routes will be shown in the directions' associated panel. To hide that list, set hideRouteList to true.

The InfoWindow in which to render text information when a marker is clicked. Existing info window content will be overwritten and its position moved. If no info window is specified, the DirectionsRenderer will create and use its own info window. This property will be ignored if suppressInfoWindows is set to true.

Options for the polylines. All polylines rendered by the DirectionsRenderer will use these options.

preserveViewport

Type:boolean

By default, the input map is centered and zoomed to the bounding box of this set of directions. If this option is set to true, the viewport is left unchanged, unless the map's center and zoom were never set.

routeIndex

Type:number

The index of the route within the DirectionsResult object. The default value is 0.

suppressBicyclingLayer

Type:boolean

Suppress the rendering of the BicyclingLayer when bicycling directions are requested.

suppressInfoWindows

Type:boolean

Suppress the rendering of info windows.

suppressMarkers

Type:boolean

Suppress the rendering of markers.

suppressPolylines

Type:boolean

Suppress the rendering of polylines.

DirectionsService
class

google.maps.DirectionsService
class

A service for computing directions between two or more places.

Constructor

DirectionsService()

Creates a new instance of a DirectionsService that sends directions queries to Google servers.

Settings that apply only to requests where travelMode is DRIVING. This object will have no effect for other travel modes.

optimizeWaypoints

Type:boolean

If set to true, the DirectionService will attempt to re-order the supplied intermediate waypoints to minimize overall cost of the route. If waypoints are optimized, inspect DirectionsRoute.waypoint_order in the response to determine the new ordering.

Array of intermediate waypoints. Directions will be calculated from the origin to the destination by way of each waypoint in this array. The maximum allowed waypoints is 8, plus the origin, and destination. Premium Plan customers are allowed 23 waypoints, plus the origin, and destination. Waypoints are not supported for transit directions. Optional.

Place
object specification

The LatLng of the entity described by this place. This must be provided for the Place to be considered valid.

placeId

Type:string

The place ID of the place (such as a business or point of interest). The place ID is a unique identifier of a place in the Google Maps database. Note that the placeId is the most accurate way of identifying a place. If possible, you should specify the placeId rather than a placeQuery. A place ID can be retrieved from any request to the Places API, such as a TextSearch. Place IDs can also be retrieved from requests to the Geocoding API. For more information, see the overview of place IDs.

query

Type:string

A search query describing the place (such as a business or point of interest). An example query is "Quay, Upper Level, Overseas Passenger Terminal 5 Hickson Road, The Rocks NSW". If possible, you should specify the placeId rather than a placeQuery. The API does not guarantee the accuracy of resolving the query string to a place. If both the placeId and placeQuery are provided, an error occurs.

TravelMode
constants

google.maps.TravelMode
constants

The valid travel modes that can be specified in a DirectionsRequest as well as the travel modes returned in a DirectionsStep. Specify these by value, or by using the constant's name. For example, 'BICYCLING' or google.maps.TravelMode.BICYCLING.

UnitSystem
constants

Specifies that distances in the DirectionsResult should be expressed in imperial units.

METRIC

Specifies that distances in the DirectionsResult should be expressed in metric units.

TransitOptions
object specification

google.maps.TransitOptions
object specification

The TransitOptions object to be included in a DirectionsRequest when the travel mode is set to TRANSIT.

Properties

arrivalTime

Type:Date

The desired arrival time for the route, specified as a Date object. The Date object measures time in milliseconds since 1 January 1970. If arrival time is specified, departure time is ignored.

departureTime

Type:Date

The desired departure time for the route, specified as a Date object. The Date object measures time in milliseconds since 1 January 1970. If neither departure time nor arrival time is specified, the time is assumed to be "now".

A preference that can bias the choice of transit route, such as less walking. If no preference is given, the API returns the default best route.

TransitMode
constants

google.maps.TransitMode
constants

The valid transit mode e.g. bus that can be specified in a TransitOptions. Specify these by value, or by using the constant's name. For example, 'BUS' or google.maps.TransitMode.BUS.

Constant

BUS

Specifies bus as a preferred mode of transit.

RAIL

Specifies rail as a preferred mode of transit.

SUBWAY

Specifies subway as a preferred mode of transit.

TRAIN

Specifies train as a preferred mode of transit.

TRAM

Specifies tram as a preferred mode of transit.

TransitRoutePreference
constants

google.maps.TransitRoutePreference
constants

The valid transit route type that can be specified in a TransitOptions. Specify these by value, or by using the constant's name. For example, 'LESS_WALKING' or google.maps.TransitRoutePreference.LESS_WALKING.

Constant

FEWER_TRANSFERS

Specifies that the calculated route should prefer a limited number of transfers.

LESS_WALKING

Specifies that the calculated route should prefer limited amounts of walking.

DrivingOptions
object specification

The desired departure time for the route, specified as a Date object. The Date object measures time in milliseconds since 1 January 1970. This must be specified for a DrivingOptions to be valid. The departure time must be set to the current time or some time in the future. It cannot be in the past.

The preferred assumption to use when predicting duration in traffic. The default is BEST_GUESS.

TrafficModel
constants

google.maps.TrafficModel
constants

The assumptions to use when predicting duration in traffic. Specified as part of a DirectionsRequest or DistanceMatrixRequest. Specify these by value, or by using the constant's name. For example, 'bestguess' or google.maps.TrafficModel.BEST_GUESS.

Constant

BEST_GUESS

Use historical traffic data to best estimate the time spent in traffic.

OPTIMISTIC

Use historical traffic data to make an optimistic estimate of what the duration in traffic will be.

PESSIMISTIC

Use historical traffic data to make a pessimistic estimate of what the duration in traffic will be.

DirectionsWaypoint
object specification

google.maps.DirectionsWaypoint
object specification

A DirectionsWaypoint represents a location between origin and destination through which the trip should be routed.

Waypoint location. Can be an address string, a LatLng, or a Place. Optional.

stopover

Type:boolean

If true, indicates that this waypoint is a stop between the origin and destination. This has the effect of splitting the route into two legs. If false, indicates that the route should be biased to go through this waypoint, but not split into two legs. This is useful if you want to create a route in response to the user dragging waypoints on a map. This value is true by default. Optional.

DirectionsStatus
constants

google.maps.DirectionsStatus
constants

The status returned by the DirectionsService on the completion of a call to route(). Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.DirectionsStatus.OK.

Constant

INVALID_REQUEST

The DirectionsRequest provided was invalid.

MAX_WAYPOINTS_EXCEEDED

Too many DirectionsWaypoints were provided in the DirectionsRequest. The total allowed waypoints is 8, plus the origin and destination. Premium Plan customers are allowed 23 waypoints, plus the origin, and destination.

NOT_FOUND

At least one of the origin, destination, or waypoints could not be geocoded.

OK

The response contains a valid DirectionsResult.

OVER_QUERY_LIMIT

The webpage has gone over the requests limit in too short a period of time.

REQUEST_DENIED

The webpage is not allowed to use the directions service.

UNKNOWN_ERROR

A directions request could not be processed due to a server error. The request may succeed if you try again.

ZERO_RESULTS

No route could be found between the origin and destination.

DirectionsResult
object specification

google.maps.DirectionsResult
object specification

The directions response retrieved from the directions server. You can render these using a DirectionsRenderer or parse this object and render it yourself. You must display the warnings and copyrights as noted in the Maps API terms of service. Note that though this result is "JSON-like," it is not strictly JSON, as it indirectly includes LatLng objects.

An array of DirectionsRoutes, each of which contains information about the legs and steps of which it is composed. There will only be one route unless the DirectionsRequest was made with provideRouteAlternatives set to true.

DirectionsGeocodedWaypoint
object specification

google.maps.DirectionsGeocodedWaypoint
object specification

A single geocoded waypoint.

Properties

partial_match

Type:boolean

Whether the geocoder did not return an exact match for the original waypoint, though it was able to match part of the requested address.

place_id

Type:string

The place ID associated with the waypoint. Place IDs uniquely identify a place in the Google Places database and on Google Maps. Learn more about Place IDs in the Places API developer guide.

types

Type:Array<string>

An array of strings denoting the type of the returned geocoded element. For a list of possible strings, refer to the Address Component Types section of the Developer's Guide.

DirectionsRoute
object specification

google.maps.DirectionsRoute
object specification

A single route containing a set of legs in a DirectionsResult. Note that though this object is "JSON-like," it is not strictly JSON, as it directly and indirectly includes LatLng objects.

An array of DirectionsLegs, each of which contains information about the steps of which it is composed. There will be one leg for each stopover waypoint or destination specified. So a route with no stopover waypoints will contain one DirectionsLeg and a route with one stopover waypoint will contain two.

An array of LatLngs representing the entire course of this route. The path is simplified in order to make it suitable in contexts where a small number of vertices is required (such as Static Maps API URLs).

If optimizeWaypoints was set to true, this field will contain the re-ordered permutation of the input waypoints. For example, if the input was: Origin: Los Angeles Waypoints: Dallas, Bangor, Phoenix Destination: New York and the optimized output was ordered as follows: Origin: Los Angeles Waypoints: Phoenix, Dallas, Bangor Destination: New York then this field will be an Array containing the values [2, 0, 1]. Note that the numbering of waypoints is zero-based. If any of the input waypoints has stopover set to false, this field will be empty, since route optimization is not available for such queries.

DirectionsLeg
object specification

google.maps.DirectionsLeg
object specification

A single leg consisting of a set of steps in a DirectionsResult. Some fields in the leg may not be returned for all requests. Note that though this result is "JSON-like," it is not strictly JSON, as it directly and indirectly includes LatLng objects.

The total duration of this leg, taking into account the traffic conditions indicated by the trafficModel property. This property may be undefined as the duration may be unknown. Only available to Premium Plan customers when drivingOptions is defined when making the request.

The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. end_location indicates the actual geocoded destination, which may be different than the end_location of the last step if, for example, the road is not near the destination of this leg.

The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. start_location indicates the actual geocoded origin, which may be different than the start_location of the first step if, for example, the road is not near the origin of this leg.

An array of non-stopover waypoints along this leg, which were specified in the original request.

Deprecated in alternative routes. Version 3.27 will be the last version of the API that adds extra via_waypoints in alternative routes.

When using the Directions Service to implement draggable directions, it is recommended to disable dragging of alternative routes. Only the main route should be draggable. Users can drag the main route until it matches an alternative route.

DirectionsStep
object specification

google.maps.DirectionsStep
object specification

A single DirectionsStep in a DirectionsResult. Some fields may be undefined. Note that though this object is "JSON-like," it is not strictly JSON, as it directly includes LatLng objects.

PathElevationRequest
object specification

google.maps.PathElevationRequest
object specification

An elevation query sent by the ElevationService containing the path along which to return sampled data. This request defines a continuous path along the earth along which elevation samples should be taken at evenly-spaced distances. All paths from vertex to vertex use segments of the great circle between those two points.

The distance, in meters, between sample points from which the elevation was interpolated. This property will be missing if the resolution is not known. Note that elevation data becomes more coarse (larger resolution values) when multiple points are passed. To obtain the most accurate elevation value for a point, it should be queried independently.

ElevationStatus
constants

google.maps.ElevationStatus
constants

The status returned by the ElevationService upon completion of an elevation request. Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.ElevationStatus.OK.

Constant

INVALID_REQUEST

This request was invalid.

OK

The request did not encounter any errors.

OVER_QUERY_LIMIT

The webpage has gone over the requests limit in too short a period of time.

REQUEST_DENIED

The webpage is not allowed to use the elevation service for some reason.

UNKNOWN_ERROR

A geocoding, directions or elevation request could not be successfully processed, yet the exact reason for the failure is not known.

MaxZoomService
class

google.maps.MaxZoomService
class

A service for obtaining the highest zoom level at which satellite imagery is available for a given location.

Constructor

MaxZoomService()

Creates a new instance of a MaxZoomService that can be used to send queries about the maximum zoom level available for satellite imagery.

Returns the maximum zoom level available at a particular LatLng for the Satellite map type. As this request is asynchronous, you must pass a callback function which will be executed upon completion of the request, being passed a MaxZoomResult.

MaxZoomStatus
constants

google.maps.MaxZoomStatus
constants

The status returned by the MaxZoomService on the completion of a call to getMaxZoomAtLatLng(). Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.MaxZoomStatus.OK.

Constant

ERROR

There was a problem contacting the Google servers.

OK

The response contains a valid MaxZoomResult.

DistanceMatrixService
class

google.maps.DistanceMatrixService
class

A service for computing distances between multiple origins and destinations.

Constructor

DistanceMatrixService()

Creates a new instance of a DistanceMatrixService that sends distance matrix queries to Google servers.

The duration for this origin-destination pairing, taking into account the traffic conditions indicated by the trafficModel property. This property may be undefined as the duration may be unknown. Only available to Premium Plan customers when drivingOptions is defined when making the request.

DistanceMatrixStatus
constants

google.maps.DistanceMatrixStatus
constants

The top-level status about the request in general returned by the DistanceMatrixService upon completion of a distance matrix request. Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.DistanceMatrixStatus.OK.

Constant

INVALID_REQUEST

The provided request was invalid.

MAX_DIMENSIONS_EXCEEDED

The request contains more than 25 origins, or more than 25 destinations.

MAX_ELEMENTS_EXCEEDED

The product of origins and destinations exceeds the per-query limit.

OK

The response contains a valid result.

OVER_QUERY_LIMIT

Too many elements have been requested within the allowed time period. The request should succeed if you try again after a reasonable amount of time.

REQUEST_DENIED

The service denied use of the Distance Matrix service by your web page.

UNKNOWN_ERROR

A Distance Matrix request could not be processed due to a server error. The request may succeed if you try again.

DistanceMatrixElementStatus
constants

google.maps.DistanceMatrixElementStatus
constants

The element-level status about a particular origin-destination pairing returned by the DistanceMatrixService upon completion of a distance matrix request. These values are specified as strings, for example, 'OK'.

Constant

NOT_FOUND

The origin and/or destination of this pairing could not be geocoded.

OK

The response contains a valid result.

ZERO_RESULTS

No route could be found between the origin and destination.

Attribution
object specification

google.maps.Attribution
object specification

Properties

iosDeepLinkId

Type:string

The iOS deep link to associate with this place when a user saves the place. When the user views the place in an iOS app, this URL will serve as the link on the source string. If there is no deep link or the app that handles the deep link is not present, the webURL will be used instead.

source

Type:string

The source (origin) to associate with this place when it is saved by a user. For example, this could be the name of your website or application. The user who saved the place will see this source when they view the place in Google Maps. source is required for an Attribution to be considered valid. If it is not provided an error will be thrown.

webUrl

Type:string

The URL (http or https) of the page to associate with this place when a user saves the place. When the user views the place in a desktop or Android app, this URL will serve as the link on the source string. When the user views the place in an iOS app, and there is no deep link provided or the app that handles the deep link is not present, this URL will serve as the link on the source string.

MarkerPlace
object specification

The LatLng of the entity described by this Place. This must be provided for the Place to be considered valid.

placeId

Type:string

The place ID of the place (such as a business or point of interest). The place ID is a unique identifier of a place in the Google Maps database. Note that the placeId is the most accurate way of identifying a place. If possible, you should specify the placeId rather than a placeQuery. A place ID can be retrieved from any request to the Places API, such as a TextSearch. Place IDs can also be retrieved from requests to the Geocoding API.

query

Type:string

A search query describing the place (such as a business or point of interest). An example query would be "Quay, Upper Level, Overseas Passenger Terminal 5 Hickson Road, The Rocks NSW". If possible, you should specify the placeId rather than a placeQuery. The API does not guarantee the accuracy of resolving the query string to a place. If both the placeId and placeQuery are provided, an error is thrown.

SaveWidget
class

google.maps.SaveWidget
class

A control that users can use to save a place to Google Maps from your website. In this context, 'place' means a business, point of interest or geographic location. The SaveWidget has a fixed height of 22px.

The SaveWidget is only available when signed_in=true has been passed as a URL parameter in the bootstrap request.

Note: The signed-in maps feature is deprecated. Versions 3.27 and earlier of the Google Maps JavaScript API continue to support signed-in maps. A future version will no longer support signed-in maps, and will not support saving a place directly from within your website. Read more about signed-in maps.

MapTypeRegistry
class

The MapTypeRegistry holds the collection of custom map types available to the map for its use. The API consults this registry when providing the list of avaiable map types within controls, for example.

Projection
object specification

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.

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.

StyledMapType
class

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.

StyledMapTypeOptions
object specification

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.

MapTypeStyle
object specification

google.maps.MapTypeStyle
object specification

The MapTypeStyle is a collection of selectors and stylers that define how the map should be styled. Selectors specify the map features and/or elements that should be affected, and stylers specify how those features and elements should be modified. For details, see the style reference.

Properties

elementType

Type:string

The element to which a styler should be applied. An element is a visual aspect of a feature on the map. Example: a label, an icon, the stroke or fill applied to the geometry, and more. Optional. If elementType is not specified, the value is assumed to be 'all'. For details of usage and allowed values, see the style reference.

featureType

Type:string

The feature, or group of features, to which a styler should be applied. Optional. If featureType is not specified, the value is assumed to be 'all'. For details of usage and allowed values, see the style reference.

stylers

Type:Array<Object>

The style rules to apply to the selected map features and elements. The rules are applied in the order that you specify in this array. For guidelines on usage and allowed values, see the style reference.

By default, the input map is centered and zoomed to the bounding box of the contents of the layer. If this option is set to true, the viewport is left unchanged, unless the map's center and zoom were never set.

screenOverlays

Type:boolean

Whether to render the screen overlays. Default true.

suppressInfoWindows

Type:boolean

Suppress the rendering of info windows when layer features are clicked.

KmlFeatureData
object specification

google.maps.KmlFeatureData
object specification

Data for a single KML feature in JSON format, returned when a KML feature is clicked. The data contained in this object mirrors that associated with the feature in the KML or GeoRSS markup in which it is declared.

Returns the heading and pitch of the photographer when this panorama was taken. For Street View panoramas on the road, this also reveals in which direction the car was travelling. This data is available after the pano_changed event.

Additional controls to attach to the panorama. To add a control to the panorama, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.

Events

closeclick

Arguments:Event

This event is fired when the close button is clicked.

pano_changed

Arguments:None

This event is fired when the panorama's pano id changes. The pano may change as the user navigates through the panorama or the position is manually set. Note that not all position changes trigger a pano_changed.

position_changed

Arguments:None

This event is fired when the panorama's position changes. The position changes as the user navigates through the panorama or the position is set manually.

pov_changed

Arguments:None

This event is fired when the panorama's point-of-view changes. The point of view changes as the pitch, zoom, or heading changes.

resize

Arguments:None

Developers should trigger this event on the panorama when its div changes size: google.maps.event.trigger(panorama, 'resize').

status_changed

Arguments:None

This event is fired after every panorama lookup by id or location, via setPosition() or setPano().

visible_changed

Arguments:None

This event is fired when the panorama's visibility changes. The visibility is changed when the Pegman is dragged onto the map, the close button is clicked, or setVisible() is called.

The enabled/disabled state of the imagery acquisition date control. Disabled by default.

linksControl

Type:boolean

The enabled/disabled state of the links control.

motionTracking

Type:boolean

Whether motion tracking is on or off. Enabled by default when the motion tracking control is present, so that the POV (point of view) follows the orientation of the device. This is primarily applicable to mobile devices. If motionTracking is set to false while motionTrackingControl is enabled, the motion tracking control appears but tracking is off. The user can tap the motion tracking control to toggle this option.

motionTrackingControl

Type:boolean

The enabled/disabled state of the motion tracking control. Enabled by default when the device has motion data, so that the control appears on the map. This is primarily applicable to mobile devices.

PanoProviderOptions
object specification

google.maps.PanoProviderOptions
object specification

Options for the Custom Pano Provider.

Properties

cors

Type:boolean

If set, the renderer will use technologies (like webgl) that only work when cors headers are appropiately set on the provided images. It is the developer's task to serve the images correctly in combination with this flag, which might otherwise lead to SecurityErrors.

A unique identifier for the panorama. This is stable within a session but unstable across sessions.

shortDescription

Type:string

Short description of the location.

StreetViewPreference
constants

google.maps.StreetViewPreference
constants

Options that bias a search result towards returning a Street View panorama that is nearest to the request location, or a panorama that is considered most likely to be what the user wants to see. Specify these by value, or by using the constant's name. For example, 'best' or google.maps.StreetViewPreference.BEST.

Constant

BEST

Return the Street View panorama that is considered most likely to be what the user wants to see. The best result is determined by algorithms based on user research and parameters such as recognised points of interest, image quality, and distance from the given location.

NEAREST

Return the Street View panorama that is the shortest distance from the provided location. This works well only within a limited radius. The recommended radius is 1km or less.

StreetViewSource
constants

google.maps.StreetViewSource
constants

Identifiers to limit Street View searches to selected sources. These values are specified as strings. For example, 'outdoor'.

Constant

DEFAULT

Uses the default sources of Street View, searches will not be limited to specific sources.

OUTDOOR

Limits Street View searches to outdoor collections. Indoor collections are not included in search results. Note also that the search only returns panoramas where it's possible to determine whether they're indoors or outdoors. For example, PhotoSpheres are not returned because it's unknown whether they are indoors or outdoors.

StreetViewTileData
object specification

google.maps.StreetViewTileData
object specification

The properties of the tile set used in a Street View panorama.

Methods

getTileUrl(pano:string, tileZoom:number, tileX:number, tileY:number)

Return Value:string

Gets the tile image URL for the specified tile.pano is the panorama ID of the Street View tile.tileZoom is the zoom level of the tile.tileX is the x-coordinate of the tile.tileY is the y-coordinate of the tile. Returns the URL for the tile image.

Retrieves the StreetViewPanoramaData for a panorama that matches the supplied Street View query request. The StreetViewPanoramaData is passed to the provided callback.

StreetViewStatus
constants

google.maps.StreetViewStatus
constants

The status returned by the StreetViewService on completion of a Street View request. These can be specified by value, or by using the constant's name. For example, 'OK' or google.maps.StreetViewStatus.OK.

Constant

OK

The request was successful.

UNKNOWN_ERROR

The request could not be successfully processed, yet the exact reason for failure is unknown.

ZERO_RESULTS

There are no panoramas found that match the search criteria.

StreetViewCoverageLayer
class

google.maps.StreetViewCoverageLayer
class

A layer that illustrates the locations where Street View is available.

The latitude/longitude that was below the cursor when the event occurred.

IconMouseEvent
object specification

google.maps.IconMouseEvent
object specification

This object is sent in an event when a user clicks on an icon on the map. The place ID of this place is stored in the placeId member. To prevent the default info window from showing up, call the stop() method on this event to prevent it being propagated. Learn more about place IDs in the Places API developer guide.

LatLng
class

google.maps.LatLng
class

A LatLng is a point in geographical coordinates: latitude and longitude.

Latitude ranges between -90 and 90 degrees, inclusive. Values above or below this range will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.

Longitude ranges between -180 and 180 degrees, inclusive. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.

Although the default map projection associates longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude coordinate is always written first, followed by the longitude. Notice that you cannot modify the coordinates of a LatLng. If you want to compute another point, you have to create a new one.

Most methods that accept LatLng objects also accept a LatLngLiteral object, so that the following are equivalent:

The constructor also accepts literal objects, and converts them to instances of LatLng:

myLatLng = new google.maps.LatLng({lat: -34, lng: 151});

Constructor

LatLng(lat:number, lng:number, noWrap?:boolean)

Creates a LatLng object representing a geographic point. Latitude is specified in degrees within the range [-90, 90]. Longitude is specified in degrees within the range [-180, 180]. Set noWrap to true to enable values outside of this range. Note the ordering of latitude and longitude.

Latitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.

lng

Type:number

Longitude in degrees. Values outside the range [-180, 180] will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.

LatLngBounds
class

google.maps.LatLngBounds
class

A LatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian.

Returns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this bounds, where "lo" corresponds to the southwest corner of the bounding box, while "hi" corresponds to the northeast corner of that box.

Extends this bounds to contain the union of this and the given bounds.

LatLngBoundsLiteral
object specification

google.maps.LatLngBoundsLiteral
object specification

Object literals are accepted in place of LatLngBounds objects throughout the API. These are automatically converted to LatLngBounds objects. All south, west, north and east must be set, otherwise an exception is thrown.

Properties

east

Type:number

East longitude in degrees. Values outside the range [-180, 180] will be wrapped to the range [-180, 180). For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.

north

Type:number

North latitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.

south

Type:number

South latitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.

west

Type:number

West longitude in degrees. Values outside the range [-180, 180] will be wrapped to the range [-180, 180). For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.

MVCObject
class

google.maps.MVCObject
class

Base class implementing KVO.

The MVCObject constructor is guaranteed to be an empty function, and so you may inherit from MVCObject by simply writing MySubclass.prototype = new google.maps.MVCObject();. Unless otherwise noted, this is not true of other classes in the API, and inheriting from other classes in the API is not supported.

Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.

Returns the signed area of a closed path. The signed area may be used to determine the orientation of the path. The computed area uses the same units as the radius. The radius defaults to the Earth's radius in meters, in which case the area is in square meters.

Computes whether the given point lies on or near to a polyline, or the edge of a polygon, within a specified tolerance. Returns true when the difference between the latitude and longitude of the supplied point, and the closest point on the edge, is less than the tolerance. The tolerance defaults to 10-9 degrees.

Autocomplete
class

google.maps.places.Autocomplete
class

A service to provide Place predictions based on a user's text input. It attaches to an input element of type text, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.

Sets the component restrictions. Component restrictions are used to restrict predictions to only those within the parent component. E.g., the country.

setTypes(types:Array<string>)

Return Value:None

Sets the types of predictions to be returned. For a list of supported types, see the developer's guide. If no type is specified, all types will be returned. The setTypes method accepts a single element array.

Events

place_changed

Arguments:None

This event is fired when a PlaceResult is made available for a Place the user has selected. If the user enters the name of a Place that was not suggested by the control and presses the Enter key, or if a Place Details request fails, the PlaceResult contains the user input in the name property, with no other properties defined.

The component restrictions. Component restrictions are used to restrict predictions to only those within the parent component. E.g., the country.

types

Type:Array<string>

The types of predictions to be returned. For a list of supported types, see the developer's guide. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix the 'geocode' and 'establishment' types, but note that this will have the same effect as specifying no types.

AutocompletePrediction
object specification

google.maps.places.AutocompletePrediction
object specification

Library

places

Properties

description

Type:string

This is the unformatted version of the query suggested by the Places service.

A set of substrings in the place's description that match elements in the user's input, suitable for use in highlighting those substrings. Each substring is identified by an offset and a length, expressed in unicode characters.

place_id

Type:string

A place ID that can be used to retrieve details about this place using the place details service (see PlacesService.getDetails()).

Location for prediction biasing. Predictions will be biased towards the given location and radius. Alternatively, bounds can be used.

offset

Type:number

The character position in the input term at which the service uses text for predictions (the position of the cursor in the input field).

radius

Type:number

The radius of the area used for prediction biasing. The radius is specified in meters, and must always be accompanied by a location property. Alternatively, bounds can be used.

types

Type:Array<string>

The types of predictions to be returned. Four types are supported: 'establishment' for businesses, 'geocode' for addresses, '(regions)' for administrative regions and '(cities)' for localities. If nothing is specified, all types are returned.

ComponentRestrictions
object specification

google.maps.places.ComponentRestrictions
object specification

Defines the component restrictions that can be used with the autocomplete service.

URL to an image resource that can be used to represent this Place's category.

international_phone_number

Type:string

The Place's phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign.

name

Type:string

The Place's name. Note: In the case of user entered Places, this is the raw text, as typed by the user. Please exercise caution when using this data, as malicious users may try to use it as a vector for code injection attacks (See http://en.wikipedia.org/wiki/Code_injection).

permanently_closed

Type:boolean

A flag indicating whether the Place is permanently closed. If the place is not permanently closed, the flag is not present in search or details responses.

An array of types for this Place (e.g., ["political", "locality"] or ["restaurant", "establishment"]).

url

Type:string

URL of the official Google page for this place. This is the Google-owned page that contains the best available information about the place.

utc_offset

Type:number

The offset from UTC of the Place's current timezone, in minutes. For example, Sydney, Australia in daylight savings is 11 hours ahead of UTC, so the utc_offset will be 660. For timezones behind UTC, the offset is negative. For example, utc_offest is -60 for Cape Verde.

vicinity

Type:string

A fragment of the Place's address for disambiguation (usually street name and locality).

website

Type:string

The authoritative website for this Place, such as a business' homepage.

Library

A link to the reviewer's profile. This will be undefined when the reviewer's profile is unavailable.

language

Type:string

An IETF language code indicating the language in which this review is written. Note that this code includes only the main language tag without any secondary tag indicating country or region. For example, all the English reviews are tagged as 'en' rather than 'en-AU' or 'en-UK'.

text

Type:string

The text of a review.

PlaceSearchPagination
object specification

google.maps.places.PlaceSearchPagination
object specification

An object used to fetch additional pages of Places results.

Library

places

Methods

nextPage()

Return Value:None

Fetches the next page of results. Uses the same callback function that was provided to the first search request.

Properties

hasNextPage

Type:boolean

Indicates if further results are available. true when there is an additional results page.

Restricts results to only those places at the specified price level or lower. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. Must be greater than or equal to minPrice , if specified.

minPriceLevel

Type:number

Restricts results to only those places at the specified price level or higher. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. Must be less than or equal to maxPrice, if specified.

name

Type:string

Restricts the Place search results to Places that include this text in the name.

openNow

Type:boolean

Restricts results to only those places that are open right now.

radius

Type:number

The distance from the given location within which to search for Places, in meters. The maximum allowed value is 50 000.

Specifies the ranking method to use when returning results. Defaults to PROMINENCE. Note that when rankBy is set to DISTANCE, you must specify a location but you cannot specify a radius or bounds.

type

Type:string

Searches for places of the given type. The type is translated to the local language of the request's target location and used as a query string. If a query is also provided, it is concatenated to the localized type string. Results of a different type are dropped from the response. Use this field to perform language and region independent categorical searches. Valid types are given here.

PlacesService
class

google.maps.places.PlacesService
class

Contains methods related to searching for places and retrieving details about a place.

Retrieves a list of places near a particular location, based on keyword or type. Location must always be specified, either by passing a LatLngBounds, or location and radius parameters. The PlaceResults passed to the callback are subsets of the full PlaceResult. Your app can get a more detailed PlaceResult for each place by sending a Place Details request passing the reference value for the desired place. The PlaceSearchPagination object can be used to fetch additional pages of results (null if this is the last page of results or if there is only one page of results).

Retrieves a list of places based on a query string (for example, "pizza in New York", or "shoe stores near Ottawa"). Location parameters are optional; when the region is specified, results are only biased toward nearby results rather than restricted to places inside the area. Use textSearch when you want to search for places using an arbitrary string, and in cases where you may not want to restrict search results to a particular location. The PlaceSearchPagination object can be used to fetch additional pages of results (null if this is the last page of results or if there is only one page of results).

PlacesServiceStatus
constants

google.maps.places.PlacesServiceStatus
constants

The status returned by the PlacesService on the completion of its searches. Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.places.PlacesServiceStatus.OK.

Library

places

Constant

INVALID_REQUEST

This request was invalid.

OK

The response contains a valid result.

OVER_QUERY_LIMIT

The application has gone over its request quota.

REQUEST_DENIED

The application is not allowed to use the PlacesService.

UNKNOWN_ERROR

The PlacesService request could not be processed due to a server error. The request may succeed if you try again.

ZERO_RESULTS

No result was found for this request.

QueryAutocompletePrediction
object specification

google.maps.places.QueryAutocompletePrediction
object specification

Represents a single Query Autocomplete prediction.

Library

places

Properties

description

Type:string

This is the unformatted version of the query suggested by the Places service.

A set of substrings in the place's description that match elements in the user's input, suitable for use in highlighting those substrings. Each substring is identified by an offset and a length, expressed in unicode characters.

place_id

Type:string

Only available if prediction is a place. A place ID that can be used to retrieve details about this place using the place details service (see PlacesService.getDetails()).

Information about individual terms in the above description. Categorical terms come first (e.g., "restaurant"). Address terms appear from most to least specific. For example, "San Francisco", and "CA".

QueryAutocompletionRequest
object specification

google.maps.places.QueryAutocompletionRequest
object specification

An QueryAutocompletion request to be sent to the QueryAutocompleteService.

RadarSearchRequest
object specification

Library

Bounds used to bias results when searching for Places (optional). Both location and radius will be ignored if bounds is set. Results will not be restricted to those inside these bounds; but, results inside it will rank higher.

keyword

Type:string

A term to be matched against all available fields, including but not limited to name, type, and address, as well as customer reviews and other third-party content.

The center of the area used to bias results when searching for Places.

name

Type:string

Restricts results to Places that include this text in the name.

radius

Type:number

The radius of the area used to bias results when searching for Places, in meters.

type

Type:string

Searches for places of the given type. The type will be translated to the local language of the request's target location and used as query. If a query is also provided, it will be concatenated to the localized type string. Results of a different type will be dropped from the response. Use this to search for language and region independent categorical search. here.

RankBy
constants

google.maps.places.RankBy
constants

Ranking options for a PlaceSearchRequest.

Library

places

Constant

DISTANCE

Ranks place results by distance from the location.

PROMINENCE

Ranks place results by their prominence.

SearchBox
class

google.maps.places.SearchBox
class

A service to provide query predictions based on a user's text input. It attaches to an input element of type text, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.

TextSearchRequest
object specification

Library

Bounds used to bias results when searching for Places (optional). Both location and radius will be ignored if bounds is set. Results will not be restricted to those inside these bounds; but, results inside it will rank higher.

The center of the area used to bias results when searching for Places.

query

Type:string

The request's query term. e.g. the name of a place ('Eiffel Tower'), a category followed by the name of a location ('pizza in New York'), or the name of a place followed by a location disambiguator ('Starbucks in Sydney').

radius

Type:number

The radius of the area used to bias results when searching for Places, in meters.

type

Type:string

Searches for places of the given type. The type is translated to the local language of the request's target location and used as a query string. If a query is also provided, it is concatenated to the localized type string. Results of a different type are dropped from the response. Use this field to perform language and region independent categorical searches. Valid types are given here.

DrawingManager
class

google.maps.drawing.DrawingManager
class

Allows users to draw markers, polygons, polylines, rectangles, and circles on the map. The DrawingManager's drawing mode defines the type of overlay that will be created by the user. Adds a control to the map, allowing the user to switch drawing mode.

Changes the DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are 'marker', 'polygon', 'polyline', 'rectangle', 'circle', or null. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything.

The DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are 'marker', 'polygon', 'polyline', 'rectangle', 'circle', or null. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything.

DrawingControlOptions
object specification

Library

The drawing modes to display in the drawing control, in the order in which they are to be displayed. The hand icon (which corresponds to the null drawing mode) is always available and is not to be specified in this array. Defaults to ['marker', 'polyline', 'rectangle', 'circle', 'polygon'].

Library

Specifies whether heatmaps dissipate on zoom. By default, the radius of influence of a data point is specified by the radius option only. When dissipating is disabled, the radius option is interpreted as a radius at zoom level 0.

gradient

Type:Array<string>

The color gradient of the heatmap, specified as an array of CSS color strings. All CSS3 colors are supported except for extended named colors.

The maximum intensity of the heatmap. By default, heatmap colors are dynamically scaled according to the greatest concentration of points at any particular pixel on the map. This property allows you to specify a fixed maximum.

opacity

Type:number

The opacity of the heatmap, expressed as a number between 0 and 1. Defaults to 0.6.

radius

Type:number

The radius of influence for each data point, in pixels.

WeightedLocation
object specification

google.maps.visualization.WeightedLocation
object specification

A data point entry for a heatmap. This is a geographical data point with a weight attribute.