Same great maps plus a SLA, support, and control over ads
The Google Maps API is now integrated with the
Google AJAX API loader, which creates a common namespace for loading and using multiple Google AJAX APIs. This
framework allows you to use the optional google.maps.* namespace for all classes, methods and
properties you currently use in the Google Maps API, replacing the normal G prefix with this namespace.
Don't worry: the existing G namespace will continue to be supported.
For example, the GMap2 object within the Google Maps API can also be defined as google.maps.Map2.
Note that this reference documentation refers only to the existing G namespace.
This is the most important class within the Maps API. The other classes in this reference are grouped by their purpose.
Instantiate class GMap2 in order to
create a map. This is the central class in the API. Everything
else is auxiliary.
| Constructor | Description |
|---|---|
GMap2(container:Node,
opts?:GMapOptions)
|
Creates a new map inside of the given HTML container, which
is typically a DIV element. If no set of map types
is given in the optional argument opts.mapTypes, the
default set G_DEFAULT_MAP_TYPES is used. If no size
is given in the optional argument opts.size, then the
size of the container is used. If opts.size
is given, then the container element of the map is resized
accordingly. See class GMapOptions.
Note: a Map needs to be centered before it can be used.
You should immediately call GMap2.setCenter()
to initialize a map created with this constructor.
|
| Method | Return Value | Description |
|---|---|---|
enableDragging()
|
None |
Enables the dragging of the map (enabled by default). |
disableDragging()
|
None |
Disables the dragging of the map. |
draggingEnabled()
|
Boolean |
Returns true iff the dragging of the map is
enabled. |
enableInfoWindow()
|
None |
Enables info window operations on the map (enabled by default). |
disableInfoWindow()
|
None |
Closes the info window, if it is open, and disables the opening of a new info window. |
infoWindowEnabled()
|
Boolean |
Returns true iff the info window is
enabled. |
enableDoubleClickZoom()
|
None |
Enables double click to zoom in and out (enabled by default). (Since 2.58) |
disableDoubleClickZoom()
|
None |
Disables double click to zoom in and out. (Since 2.58) |
doubleClickZoomEnabled()
|
Boolean |
Returns true iff double click to zoom is enabled.(Since 2.58) |
enableContinuousZoom()
|
None |
Enables continuous smooth zooming for select browsers (disabled by default). (Since 2.58) |
disableContinuousZoom()
|
None |
Disables continuous smooth zooming. (Since 2.58) |
continuousZoomEnabled()
|
Boolean |
Returns true if continuous smooth zooming is enabled.(Since 2.58) |
enableGoogleBar()
|
None |
Enables the GoogleBar, an integrated search control, to the map.
When enabled, this control takes the place of the default Powered By Google
logo. Note that this control is not enabled by default. Note: The GoogleBar is
currently not compatible with the Google Earth plugin, used by map type
GMapType.G_SATELLITE_3D_MAP, and will be disabled while the
Earth plugin is shown.(Since 2.92) |
disableGoogleBar()
|
None |
Disables the GoogleBar integrated search control. When disabled,
the default Powered by Google logo occupies the position formerly
containing this control. Note that this control is already disabled by default. (Since 2.92) |
enableScrollWheelZoom()
|
None |
Enables zooming using a mouse's scroll wheel. Note: scroll wheel
zoom is disabled by default. (Since 2.78) |
disableScrollWheelZoom()
|
None |
Disables zooming using a mouse's scroll wheel. Note: scroll wheel
zoom is disabled by default. (Since 2.78) |
scrollWheelZoomEnabled()
|
Boolean |
Returns a Boolean indicating whether scroll wheel zooming is
enabled. (Since 2.78) |
enablePinchToZoom()
|
None |
Enables pinching to zoom on an iPhone or iPod touch. Note: pinch to
zoom is enabled by default. (Since 2.143) |
disablePinchToZoom()
|
None |
Disables pinching to zoom on an iPhone or iPod touch. Note: pinch to
zoom is enabled by default. (Since 2.143) |
pinchToZoomEnabled()
|
Boolean |
Returns a Boolean indicating whether pinch to zoom is enabled. (Since 2.143) |
getDefaultUI()
|
Object |
Returns a GMapUIOptions object specifying default
behaviour and UI elements for the Map, based on the UI of
maps.google.com.
(Since 2.147) |
setUIToDefault()
|
None |
Adds the default behaviour and UI elements specified in
getDefaultUI() to the Map.
(Since 2.147) |
setUI(ui:GMapUIOptions)
|
None |
Adds behaviour and UI elements specified in the ui
parameter, which can be a modified version of the object returned from
getDefaultUI().(Since 2.147) |
| Method | Return Value | Description |
|---|---|---|
addControl(control:GControl,
position?:GControlPosition)
|
None |
Adds the control to the map. The position on the map is
determined by the optional position argument. If
this argument is absent, the default position of the control is
used, as determined by the
GControl.getDefaultPosition() method. A control
instance must not be added more than once to the map. |
removeControl(control:GControl)
|
None |
Removes the control from the map. It does nothing if the control was never added to the map. |
getContainer()
|
Node |
Returns the DOM object that contains the map. Used by
GControl.initialize(). |
| Method | Return Value | Description |
|---|---|---|
getMapTypes()
|
GMapType[] |
Returns the array of map types registered with this map. |
getCurrentMapType()
|
GMapType |
Returns the currently selected map type. |
setMapType(type:GMapType)
|
None |
Selects the given new map type. The type must be known to
the map. See the constructor, and the method
addMapType(). |
addMapType(type:GMapType)
|
None |
Adds a new map type to the map. See section GMapType for how to define
custom map types. |
removeMapType(type:GMapType)
|
None |
Removes the map type from the map. Will update the set of
buttons displayed by the GMapTypeControl or
GHierarchicalMapTypeControl and fire the
removemaptype event. |
| Method | Return Value | Description |
|---|---|---|
isLoaded()
|
Boolean |
Returns true iff the map was initialized by
setCenter() since it was created. |
getCenter()
|
GLatLng |
Returns the geographical coordinates of the center point of the map view. |
getBounds()
|
GLatLngBounds |
Returns the the visible rectangular region of the map view in geographical coordinates. |
getBoundsZoomLevel(bounds:GLatLngBounds)
|
Number |
Returns the zoom level at which the given rectangular region fits in the map view. The zoom level is computed for the currently selected map type. If no map type is selected yet, the first on the list of map types is used. |
getSize()
|
GSize |
Returns the size of the map view in pixels. |
getZoom()
|
Number |
Returns the current zoom level. |
getDragObject()
|
GDraggableObject |
Returns the draggable object used by this map. (Since 2.93) |
getEarthInstance(callback:Function(instance: GEPlugin))
|
None |
Retrieves the instance of the
Google Earth Browser Plugin attached to this map, and calls the passed
callback function once the instance is ready to receive commands, passing
the earth instance (a GEPlugin object) as a parameter.
This callback function may fire immediately if the Earth instance had previously been instantiated by setting the Google Earth map type via GMap2.setMapType(G_SATELLITE_3D_MAP). If the instance if not yet
created, calling getEarthInstance will initialize the
Google Earth Plug-in. (This asynchronous behavior is why this method requires a callback.)
Note: if the initialization encounters an error, the callback function will pass a null parameter.
Note that that while this method will create an Earth instance, it will not set the Earth map type as the current view. To so so, call GMap2.setMapType(G_SATELLITE_3D_MAP) explicitly, or allow
the user to select this map type via the MapTypeControl.
See the
Google Earth API Developer's Guide for details on how to use
the GEPlugin object.(Since 2.113) |
| Method | Return Value | Description |
|---|---|---|
setCenter(center:GLatLng,
zoom?:Number,
type?:GMapType)
|
None |
Sets the map view to the given center. Optionally, also sets
zoom level and map type. The map type must be known to the
map. See the constructor, and the method
addMapType(). This method must be called first
after construction to set the initial state of the map. It is
an error to call operations on a newly constructed GMap2
object until after this function is invoked.
|
panTo(center:GLatLng)
|
None |
Changes the center point of the map to the given point. If the point is already visible in the current map view, change the center in a smooth animation. |
panBy(distance:GSize)
|
None |
Starts a pan animation by the given distance in pixels. |
panDirection(dx:one of -1 0 +1,
dy:one of -1 0 +1)
|
None |
Starts a pan animation by half the width of the map in the
indicated directions. +1 is right and down,
-1 is left and up, respectively. |
setZoom(level:Number)
|
None |
Sets the zoom level to the given new value. |
zoomIn(latlng?:GLatLng,
doCenter?:Boolean,
doContinuousZoom?:Boolean)
|
None |
Increments zoom level by one zoom level.
If an optional latlng argument is provided, the map will attempt to
keep that location present on the zoomed-in map. (Note that the
latlng must currently be present on the zoomed-out map.)
If the optional doCenter is provided, additionally, the map will be
centered on the provided latlng.
|
zoomOut(latlng?:GLatLng,
doContinuousZoom?:Boolean)
|
None |
Decrements zoom level by one. If the latlng is provided,
the map will zoom about that point. If doContinuousZoom
is set to true, the map will use continuous zoom when zooming out. |
savePosition()
|
None |
Stores the current map position and zoom level for later
recall by returnToSavedPosition(). |
returnToSavedPosition()
|
None |
Restores the map view that was saved by
savePosition(). |
checkResize()
|
None |
Notifies the map of a change of the size of its container. Call this method after the size of the container DOM object has changed, so that the map can adjust itself to fit the new size. |
| Method | Return Value | Description |
|---|---|---|
addOverlay(overlay:GOverlay)
|
None |
Adds an overlay to the map and fires the
addoverlay event. |
removeOverlay(overlay:GOverlay)
|
None |
Removes the overlay from the map. It is an error to try to
remove an overlay that is not on the map. If the call is successful,
it fires the removeoverlay event. |
clearOverlays()
|
None |
Removes all overlays from the map, and fires the
clearoverlays event. |
getPane(pane:GMapPane)
|
Node |
Returns a DIV that holds the object in the layer identified
by pane. Used by GOverlay instances in
method GOverlay.initialize() instances to draw
themselves on the map |
| Method | Return Value | Description |
|---|---|---|
openInfoWindow(latlng:GLatLng,
node:Node,
opts?:GInfoWindowOptions)
|
None |
Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as a DOM node. |
openInfoWindowHtml(latlng:GLatLng,
html:String,
opts?:GInfoWindowOptions)
|
None |
Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text. |
openInfoWindowTabs(latlng:GLatLng,
tabs:GInfoWindowTab[],
opts?:GinfoWindowOptions)
|
None |
Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as DOM nodes. |
openInfoWindowTabsHtml(latlng:GLatLng,
tabs:GInfoWindowTab[],
opts?:GInfoWindowOptions)
|
None |
Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text. |
showMapBlowup(latlng:GLatLng,
opts?:GInfoWindowOptions)
|
None |
Opens an info window at the given point that contains a closeup view on the map around this point. |
updateInfoWindow(tabs:GInfoWindowTab[],
onupdate?:Function)
|
None |
Updates the content of the currently open GInfoWindow
object, without repositioning. The info window is resized to fit the
new content. The optional onupdate callback function is
called after the info window content is actually changed.
(Since 2.85) |
updateCurrentTab(modifier:Function,
onupdate?:Function)
|
None |
Updates the currently selected tab, causing a resize of the
GInfoWindow object, without repositioning. The
modifier function is used to modify the currently selected
tab and is passed a GInfoWindowTab as an argument. The
optional onupdate callback function is called after the
info window displays the new content.(Since 2.85) |
closeInfoWindow()
|
None |
Closes the currently open info window. |
getInfoWindow()
|
GInfoWindow |
Returns the info window object of this map. If no info
window exists yet, it is created, but not displayed. This
operation is not influenced by
enableInfoWindow(). |
| Method | Return Value | Description |
|---|---|---|
fromContainerPixelToLatLng(pixel:GPoint)
|
GLatLng |
Computes the geographical coordinates of the point at the given pixel coordinates in the DOM element that contains the map on the page. This is helpful for when you implement interaction of custom controls with the map. |
fromLatLngToContainerPixel(latlng:GLatLng)
|
GPoint |
Computes the pixel coordinates of the given geographical point
in the DOM element that contains the map on the page.
(Since 2.100) |
fromLatLngToDivPixel(latlng:GLatLng)
|
GPoint |
Computes the pixel coordinates of the given geographical
point in the DOM element that holds the draggable map. You need
this method to position a custom overlay when you implement the
GOverlay.redraw() method for a custom overlay. |
fromDivPixelToLatLng(pixel:GPoint)
|
GLatLng |
Computes the geographical coordinates from pixel coordinates
in the div that holds the draggable map. This may be helpful for when
you implement interaction with custom overlays that don't extend the
GOverlay interface. If this doesn't give you the expected output,
try the fromContainerPixelToLatLng method instead. |
| Method | Return Value | Description |
|---|---|---|
enableRotation()
|
None |
Enables rotation on the map. If the map's current GMapType
has rotatable aerial imagery in the current viewport, the aerial imagery
will be automatically displayed on the map. Aerial imagery is only
available for G_SATELLITE_MAP and G_HYBRID_MAP.
(Since 2.193) |
disableRotation()
|
None |
Disables rotation on the map. If rotatable aerial imagery is currently
being shown on the map, top-down imagery will be automatically displayed
on the map instead.
(Since 2.193) |
rotationEnabled()
|
Boolean |
Returns true if rotation is enabled on the map. (Since 2.193) |
isRotatable()
|
Boolean |
Returns true if the map is rotatable in the current viewport and
rotation is enabled on the map. The map is considered rotatable if the
current map type is G_SATELLITE_MAP or
G_HYBRID_MAP and rotatable aerial imagery is available in
the current viewport. (Since 2.193) |
changeHeading(heading:Number)
|
None |
Attempts to change the current map type of the map to a rotated aerial
map type with the specified heading. In order for the change to be
successful, GMap2.isRotatable() should return true.
(Since 2.193) |
| Event | Description |
|---|---|
addmaptype(type:GMapType)
|
This event is fired when a map type is added to the map. |
removemaptype(type:GMapType)
|
This event is fired when a map type is removed from the map. |
click(overlay:GOverlay,
latlng:GLatLng,
overlaylatlng:GLatLng)
|
This event is fired when the user clicks on the map with the mouse. A click
event passes different arguments based on the context of the click, and whether or not the click
occured on a clickable overlay. If the click does not occur on a clickable overlay,
the overlay argument is null and the latlng argument contains
the geographical coordinates of the point that was clicked. If the user clicks on an overlay that is
clickable (such as a GMarker, GPolygon,
GPolyline, or GInfoWindow), the
overlay argument contains the overlay object, while the overlaylatlng argument
contains the coordinates of the clicked overlay. In addition, a click event is then also
fired on the overlay itself.
|
dblclick(overlay:GOverlay,
latlng:GLatLng)
|
This event is fired when a double click is done on the map.
Notice that this event will not be fired if the double click was
on a marker or other clickable overlay. The geographical coordinates
of the point that was double clicked are passed in the latlng argument.
The overlay argument is always set to null.
(Since 2.83) |
singlerightclick(point:GPoint,
src:Element,
overlay?:GOverlay)
|
This event is fired when the DOM contextmenu event is
fired on the map container. If the right click was on a marker or other clickable overlay,
then the overlay is passed to the event handler in the overlay
argument. The pixel coordinates (in the DOM element that holds the map)
of the point that was right clicked and the source element of the DOM
event are passed in the point and src
arguments respectively. Note that if it is a double right click and
double click to zoom is enabled, then the map zooms out and no
singlerightclick event is fired. If, however, double click
to zoom is disabled, two singlerightclick events will be
fired.(Since 2.84) |
movestart()
|
This event is fired when the map view starts changing. This can be
caused by dragging, in which case a dragstart event
is also fired, or by invocation of a method that changes the map
view. |
move()
|
This event is fired, possibly repeatedly, while the map view is changing. |
moveend()
|
This event is fired when the change of the map view ends. |
zoomend(oldLevel:Number,
newLevel:Number)
|
This event is fired when the map reaches a new zoom level. The event handler receives the previous and the new zoom level as arguments. |
maptypechanged()
|
This event is fired when another map type is selected. |
infowindowopen()
|
This event is fired when the info window opens. |
infowindowbeforeclose()
|
This event is fired before the info window closes. (Since 2.83) |
infowindowclose()
|
This event is fired when the info window closes. The event
infowindowbeforeclose is fired before this event. If a
currently open info window is reopened at a different point using
another call to openInfoWindow*(), the events
infowindowbeforeclose, infowindowclose
and infowindowopen are fired in this order. |
addoverlay(overlay:GOverlay)
|
This event is fired when a single overlay is added to the
map by the method addOverlay(). The new overlay is
passed as an argument overlay to the event
handler. |
removeoverlay(overlay:GOverlay)
|
This event is fired when a single overlay is removed by the
method removeOverlay(). The overlay that was
removed is passed as an argument overlay to the event
handler. |
clearoverlays()
|
This event is fired when all overlays are removed at once
by the method clearOverlays(). |
mouseover(latlng:GLatLng)
|
This event is fired when the user moves the mouse over the map from outside the map. |
mouseout(latlng:GLatLng)
|
This event is fired when the user moves the mouse off the map. |
mousemove(latlng:GLatLng)
|
This event is fired when the user moves the mouse inside the map. |
dragstart()
|
This event is fired when the user starts dragging the map. |
drag()
|
This event is repeatedly fired while the user drags the map. |
dragend()
|
This event is fired when the user stops dragging the map. |
load()
|
This event is fired when the map setup is complete, and isLoaded()
would return true. This means position, zoom, and map type are all
initialized, but tile images may still be loading.(Since 2.52) |
tilesloaded()
|
This event is fired when all visible tiles have finished loading.
(Since 2.140) |
headingchanged()
|
This event is fired when the current GMapType of the map
has been changed to one with a different heading.
(Since 2.193) |
rotatabilitychanged()
|
This event is fired when the rotatability of the map has been changed.
(Since 2.193) |
GBounds is a rectangular area of the
map in pixel coordinates. Notice that a rectangle in
geographical coordinates is represented by a
GLatLngBounds object.
| Constructor | Description |
|---|---|
GBounds(points:GPoint[])
|
Constructs a rectangle that contains all the given
points. |
| Property | Type | Description |
|---|---|---|
minX
|
Number |
The x coordinate of the left edge of the rectangle. |
minY
|
Number |
The y coordinate of the top edge of the rectangle. |
maxX
|
Number |
The x coordinate of the right edge of the rectangle. |
maxY
|
Number |
The y coordinate of the bottom edge of the rectangle. |
| Method | Return Value | Description |
|---|---|---|
toString()
|
String |
Returns a string that contains the coordinates of the upper left and the lower right corner points of the box, in this order, separated by comma, surrounded by parentheses. |
equals(other:GBounds)
|
Boolean |
Returns true if all parameters in this rectangle are equal to the parameters of the other. (Since 2.98) |
mid()
|
GPoint |
Returns the pixel coordinates of the center of the rectangular area. (Since 2.88) |
min()
|
GPoint |
Returns the pixel coordinates of the upper left corner of the rectangular area. |
max()
|
GPoint |
Returns the pixel coordinates of the lower right corner of the rectangular area. |
containsBounds(other:GBounds)
|
Boolean |
Returns true if the passed rectangular area is entirely
contained in this rectangular area. |
containsPoint(point:GPoint)
|
Boolean |
Returns true if the rectangular area (inclusively) contains
the pixel coordinates.(Since 2.88) |
extend(point:GPoint)
|
None |
Enlarges this box so that the point is also contained in this box. |
This function decides whether the maps API can be used in the current browser.
| Method | Return Value | Description |
|---|---|---|
GBrowserIsCompatible()
|
Boolean |
Returns true if the current browser supports the maps
API library. |
This class makes a DOM element draggable. The static members
for changing the drag cursors affect all subsequently created draggable objects,
such as the map, zoom control slider, and overview map rectangles. The
per-instance members affect only their particular instance. For example,
before creating the map, you can call
GDraggableObject.setDraggableCursor('default') and
GDraggableObject.setDraggingCursor('move')
to get the pre-API 2.56 style. Alternatively, the Map constructor can take
options to set its DraggableObject's cursor style. See the
W3C CSS specification
for allowable cursor values.
| Constructor | Description |
|---|---|
GDraggableObject(src:Node,
opts?:GDraggableObjectOptions)
|
Sets up event handlers so that the source element can be dragged.
Left and top optionally position the element, and the optional container
serves as a bounding box.
(Since 2.59) |
| Method | Return Value | Description |
|---|---|---|
GDraggableObject.setDraggableCursor(cursor:String)
|
None |
Sets the draggable cursor for subsequently created draggable objects. (Since 2.59) |
GDraggableObject.setDraggingCursor(cursor:String)
|
None |
Sets the dragging cursor for subsequently created draggable objects. (Since 2.59) |
GDraggableObject.getDraggingCursor()
|
String |
Returns the current dragging cursor in use by the map. If not set
through the static setDraggingCursor() method, this returns
the default cursor used by the map for its controls and markers.
(Deprecated since 2.164) |
GDraggableObject.getDraggableCursor()
|
String |
Returns the current draggable cursor in use by the map. If not set
through the static setDraggableCursor() method, this returns the
default cursor used by the map for its controls and markers.
(Deprecated since 2.164) |
| Method | Return Value | Description |
|---|---|---|
setDraggableCursor(cursor:String)
|
None |
Sets the cursor when the mouse is over this draggable object. (Since 2.59) |
setDraggingCursor(cursor:String)
|
None |
Sets the cursor when the mouse is held down, dragging this
draggable object. (Since 2.59) |
moveTo(point:GPoint)
|
None |
Moves the GDraggableObject to a given absolute position. The
position is in pixel coordinates relative to the parent node. This method
uses the DOM coordinate system, i.e. the X coordinate increases to
the left, and the Y coordinate increases downwards.(Since 2.89) |
moveBy(size:GSize)
|
None |
Moves the GDraggableObject by a given size offset. This
method uses the DOM coordinate system, i.e. width increases to the left,
and height increases downwards.(Since 2.89) |
| Event | Description |
|---|---|
mousedown()
|
This event is fired in response to the DOM mousedown
event. Handling this event will prevent the default action of the
DOM mousedown event.(Since 2.84) |
mouseup()
|
This event is fired in response to the DOM mouseup
event on a draggable object. Handling this event will prevent
the default action of the DOM mouseup event.(Since 2.84) |
click()
|
This event is fired when a draggable object is clicked. (Since 2.84) |
dragstart()
|
This event is fired at the start of a draggable object's drag event
(when the user initiates a drag by clicking and dragging a draggable
object). (Since 2.84) |
drag()
|
This event is repeatedly fired while the user drags the draggable object. (Since 2.84) |
dragend()
|
This event is fired at the end of a draggable object's drag event
(when the user releases a drag). (Since 2.84) |
This class represents optional arguments to the
GDraggableObject constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
left
|
Number |
The left starting position of the object. (Since 2.59) |
top
|
Number |
The top starting position of the object. (Since 2.59) |
container
|
Node |
A DOM element that will act as a bounding box for the draggable object (Since 2.59) |
draggableCursor
|
String |
The cursor to show on mousover. (Since 2.59) |
draggingCursor
|
String |
The cursor to show while dragging. (Since 2.59) |
delayDrag
|
Boolean |
By default, the event dragstart is fired when the DOM
mousedown event is fired on a draggable DOM element.
Similarly, the event dragend is fired when the DOM
mouseup event is fired. Setting this value to
true delays drag events until the mouse
has moved from the location where the mousedown or
mouseup was generated. The default value for this
property is false.
(Deprecated since 2.146) |
GInfoWindow has no constructor. It is
created by the map and accessed by its method
GMap2.getInfoWindow().
| Method | Return Value | Description |
|---|---|---|
selectTab(index:Number)
|
None |
Selects the tab with the given index. This has the same effect as clicking on the corresponding tab. |
hide()
|
None |
Makes the info window invisible. NOTE: This doesn't close
the info window. It can be made visible again using
show(). |
show()
|
None |
Makes the info window visible if its currently invisible. |
isHidden()
|
Boolean |
Returns true iff the info window is
hidden. This includes the state that it's closed. |
reset(latlng:GLatLng,
tabs:GInfoWindowTab[],
size:GSize,
offset?:GSize,
selectedTab?:Number)
|
None |
Resets the state of the info window. Each argument may be
null and then its value will not be changed from
the current value. |
getPoint()
|
GLatLng |
Returns the geographical point at which the info window is anchored. The tip of the window points to this point on the map, modulo the pixel offset. |
getPixelOffset()
|
GSize |
Returns 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. |
getSelectedTab()
|
Number |
Returns the index, starting at 0, of the current selected tab. |
getTabs()
|
GInfoWindowTabs[] |
Returns the array of tabs in this info window. (Since 2.59) |
getContentContainers()
|
Node[] |
Returns the array of DOM nodes that hold the content of the
tabs of this info window. (Since 2.59) |
enableMaximize()
|
None |
Enables maximization of the info window. A maximizable info
window expands to fill most of the map with contents specified
via the maxContent and maxTitle
properties of GInfoWindowOptions. The info window
must have been opened with maxContent or
maxTitle options in order for
enableMaximize() or disableMaximize
to have any effect.
An info window opened with maxContent or
maxTitle will have maximization enabled by default.
(Since 2.93) |
disableMaximize()
|
None |
Disables maximization of the info window. The infowindow must
have been opened with maxContent or
maxTitle options. Note that if the info window is currently opened,
this function will remove the maximize buton but will not restore the
window to its minimized state.
(Since 2.93) |
maximize()
|
None |
Maximizes the infowindow. The infowindow must have been opened
with maxContent or maxTitle options, and it
must not have had its maximization disabled through disableMaximize.
(Since 2.93) |
restore()
|
None |
Restores the info window to its default (non-maximized) state.
The infowindow must have been opened with maxContent or
maxTitle options.(Since 2.93) |
| Event | Description |
|---|---|
closeclick()
|
This event is fired when the info window close button is clicked. |
maximizeclick()
|
Signals that the info window is about to be maximized. (Since 2.93) |
maximizeend()
|
Signals that the info window has completed maximization. (Since 2.93) |
restoreclick()
|
Signals that the info window is about to be restored to the
non-maximized state. (Since 2.93) |
restoreend()
|
Signals that the info window has completed the restore operation
to the non-maximized state.
(Since 2.93) |
Instances of this class are used in the
opts? argument to the methods
openInfoWindow(), openInfoWindowHtml(),
openInfoWindowTabs(),
openInfoWindowTabsHtml(),
the bindInfoWindow*() variants, and
showMapBlowup() of classes GMap2 and
GMarker. There is no constructor for this
class. Instead, this class is instantiated as javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
selectedTab
|
Number |
Selects the tab with the given index, starting at 0, instead of the first tab (with index 0). |
maxWidth
|
Number |
Maximum width of the info window content, in pixels. Note that this property has no effect on maximized info windows. |
noCloseOnClick
|
Boolean |
Indicates whether or not the info window should close for a click
on the map that was not on a marker. If set to true, the
info window will not close when the map is clicked. The default value
is false.
(Since 2.83) |
onOpenFn
|
Function |
Function is called after the info window is opened and the content is displayed. |
onCloseFn
|
Function |
Function is called when the info window is closed. |
zoomLevel
|
Number |
Pertinent for showMapBlowup() only.
The zoom level of the blowup map in the info window. |
mapType
|
GMapType |
Pertinent for showMapBlowup() only.
The map type of the blowup map in the info window. |
maxContent
|
String |
Specifies content to be shown when the infowindow is maximized.
The content may be either an HTML string or an HTML DOM element.
(Since 2.93) |
maxTitle
|
String |
Specifies title to be shown when the infowindow is maximized.
The content may be either an HTML string or an HTML DOM element.
(Since 2.93) |
pixelOffset
|
GSize |
Specifies a number of pixels in the up (x) and right (y) direction
to move the infowindow away from the given GLatLng.
(Since 2.98) |
An array of instances of this class can be passed
as the tabs argument to the methods
GMap2.openInfoWindowTabs(),
GMap2.openInfoWindowTabsHtml(),
GMarker.openInfoWindowTabs(),
GMarker.openInfoWindowTabsHtml(),
and the GMarker.bindInfoWindow*() variants. If the array
contains more than one element, the info window will be shown with
tabs. Every InfoWindowTab object contains two items:
content defines the content of the info window when the
tab is selected, and label defines the label of the
tab. The properties are passed as arguments to the constructor. For
the openInfoWindowTabs() methods, content
is a DOM Node. For the methods
openInfoWindowTabsHtml(), content is a
string that contains HTML text.
| Constructor | Description |
|---|---|
GInfoWindowTab(label:String,
content:Node or String)
|
Creates an info window tab data structure that can be passed
in the tabs argument to
openInfoWindowTabs*() methods. |
Instantiate this class to add keyboard bindings to a map. The key bindings are the same as for the maps application.
| Key(s) | Action |
|---|---|
| up, down, left, right | Moves the map continuously while the key is pressed. Two keys can be pressed simultaneously in order to move diagonally. |
| page down, page up, home, end | Pans the map by 3/4 its size in the corresponding direction, with a nice animation. This corresponds to the arrow buttons in the GLargeMapControl and the GSmallMapControl. |
| +, - | Zooms one level in or out, respectively. This corresponds to the + and - buttons in the GLargeMapControl and the GSmallMapControl. |
| Constructor | Description |
|---|---|
GKeyboardHandler(map:GMap2)
|
Installs keyboard event handler for the map passed as argument. |
This namespace contains utility methods useful for
identifying language settings currently in use by an application.
Language settings are often set through browser preference but may
be overridden within the Maps API load script through the hl
parameter. (See
Maps API Localization for more information.)
Note: because bidirectional languages such as Arabic
and Hebrew affect the layout of the GInfoWindow object,
these languages are only selected if explicitly requested via an
applicable hl parameter or through the addition of the
allow_bidi=true parameter to the API bootstrap request.
For more information about BCP 47, see the W3 documentation.
| Method | Return Value | Description |
|---|---|---|
GLanguage.getLanguageCode()
|
String |
Returns the BCP 47 language code (for example, "en" or "pt-BR")
in use by the application. (Since 2.148) |
GLanguage.isRtl()
|
boolean |
Returns true if the application's UI layout is
right-to-left in bidirectional languages such as Arabic or
Hebrew.(Since 2.148) |
GLatLng is a point in geographical
coordinates longitude and latitude.
Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude cooridnate is always written first, followed by the longitude, as it is custom in cartography.
Notice also that you cannot modify the coordinates
of a GLatLng. If you want to compute another point, you
have to create a new one.
| Constructor | Description |
|---|---|
GLatLng(lat:Number,
lng:Number,
unbounded?:Boolean)
|
Notice the ordering of latitude and longitude. If the
unbounded flag is true, then the
numbers will be used as passed, otherwise latitude will be
clamped to lie between -90 degrees and +90 degrees, and
longitude will be wrapped to lie between -180 degrees and +180
degrees. |
| Method | Return Value | Description |
|---|---|---|
lat()
|
Number |
Returns the latitude coordinate in degrees, as a number
between -90 and +90. If the unbounded flag was
set in the constructor, this coordinate can be outside this
interval. |
lng()
|
Number |
Returns the longitude coordinate in degrees, as a number
between -180 and +180. If the unbounded flag was
set in the constructor, this coordinate can be outside this
interval. |
latRadians()
|
Number |
Returns the latitude coordinate in radians, as a number
between -PI/2 and +PI/2. If the unbounded flag was
set in the constructor, this coordinate can be outside this
interval. |
lngRadians()
|
Number |
Returns the longitude coordinate in radians, as a number
between -PI and +PI. If the unbounded flag was
set in the constructor, this coordinate can be outside this
interval. |
equals(other:GLatLng)
|
Boolean |
Returns true iff the other size has equal
components, within certain roundoff margins. |
distanceFrom(other:GLatLng)
|
Number |
Returns the distance, in meters, from this location to the
given location. The earth is approximated as a sphere, hence the
distance could be off by as much as 0.3%. See below. (Deprecated since 2.89) |
distanceFrom(other:GLatLng,
radius?:Number)
|
Number |
Returns the distance, in meters, from this location to the
given location. By default, this distance is calculated given the default
equatorial earth radius of 6378137 meters. The earth is approximated as a
sphere, hence the distance could be off as much as 0.3%, especially
in the polar extremes. You may also pass an optional radius
argument to calculate distances between GLatLng coordinates
on spheres of a different radius than earth.(Since 2.89) |
toUrlValue()
|
String |
This version of the method has been deprecated in favor of the
revised version (shown below) which passes an
optional precision parameter.(Deprecated since 2.78) |
toUrlValue(precision?:Number)
|
String |
Returns a string that represents this location in a format suitable
for use as a URL parameter value, separated by a comma, without whitespace.
By default, precision is returned to 6 digits, which corresponds
to a resolution to 4 inches/ 11 centimeters. An optional precision
parameter allows you to specify a lower precision to reduce server load.
Note: prior to 2.78, this
precision parameter was not available.(Since 2.78) |
| Method | Return Value | Description |
|---|---|---|
GLatLng.fromUrlValue(latlng:String)
|
GLatLng |
Converts the supplied latitude/longitude String
value into a GLatLng object. The passed string should
be in the format "latitude,longitude." Any space between the
latitude and longitude values will be ignored. This method will
return a GLatLng with precision to 6 digits.(Since 2.78) |
These properties exist for backwards compatibility with v1 event handler functions only. They should not be used.
These properties mirror the return values of the
lng() and lat() accessor methods and
they allow a GLatLng to appear in places where a
GPoint is expected by a v1 client. This is
necessary where GLatLng appears in event details (i.e. in
arguments of event handler functions). In contrast to method
wrappers, it is impossible in the current infrastructure to
create event wrappers.
| Property | Type | Description |
|---|---|---|
x
|
Number |
Deprecated. |
y
|
Number |
Deprecated. |
A GLatLngBounds instance represents a
rectangle in geographical coordinates, including one that crosses
the 180 degrees meridian.
| Constructor | Description |
|---|---|
GLatLngBounds(sw?:GLatLng,
ne?:GLatLng)
|
Constructs a rectangle from the points at its south-west and north-east corners. |
| Method | Return Value | Description |
|---|---|---|
equals(other:GLatLngBounds)
|
Boolean |
Returns true iff all parameters in this
rectangle are equal to the parameters of the other, within a
certain roundoff margin. |
contains(latlng:GLatLng)
|
Boolean |
Returns true iff the geographical coordinates
of the point lie within this rectangle.(Deprecated since 2.88) |
containsLatLng(latlng:GLatLng)
|
Boolean |
Returns true iff the geographical coordinates
of the point lie within this rectangle.(Since 2.88) |
intersects(other:GLatLngBounds)
|
Boolean |
What the name says. |
containsBounds(other:GLatLngBounds)
|
Boolean |
What the name says. |
extend(latlng:GLatLng)
|
None |
Enlarges this rectangle such that it contains the given point. In longitude direction, it is enlarged in the smaller of the two possible ways. If both are equal, it is enlarged at the eastern boundary. |
getSouthWest()
|
GLatLng |
Returns the point at the south-west corner of the rectangle. |
getNorthEast()
|
GLatLng |
Returns the point at the north-east corner of the rectangle. |
toSpan()
|
GLatLng |
Returns a GLatLng whose coordinates represent
the size of this rectangle. |
isFullLat()
|
Boolean |
Returns true if this rectangle extends from the
south pole to the north pole. |
isFullLng()
|
Boolean |
Returns true if this rectangle extends fully
around the earth in the longitude direction. |
isEmpty()
|
Boolean |
Returns true if this rectangle is empty. |
getCenter()
|
GLatLng |
Returns the point at the center of the rectangle. (Since 2.52) |
This namespace contains some static methods that
help you to debug web applications. When you use one of the
write*() methods for the first time, a floating window
opens on the page and displays the written messages.
| Method | Return Value | Description |
|---|---|---|
GLog.write(message:String,
color?:String)
|
None |
Writes the message as plain text into the log window. HTML markup characters will be escaped so that they are visible as characters. |
GLog.writeUrl(url:String)
|
None |
Writes a link to the given URL into the log window. |
GLog.writeHtml(html:String)
|
None |
Writes text as HTML in the log window. |
This class represents optional arguments to the
GMap2 constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
size
|
GSize |
Sets the size in pixels of the map. The container that is passed to the map constructor will be resized to the given size. By default, the map will assume the size of its container. |
mapTypes
|
GMapType[] |
Array of map types to be used by this map. By default,
G_DEFAULT_MAP_TYPES is used. You can use this
option to restrict the set of predefined map types that is
displayed on the map, or to pass your own map types to the
map. See also GMap2.addMapType(). |
draggableCursor
|
String |
The cursor to display when the map is draggable. (Since 2.59) |
draggingCursor
|
String |
The cursor to display while dragging the map. (Since 2.59) |
googleBarOptions
|
GGoogleBarOptions |
This property specifies the options to configure the GoogleBar search control.
These options are passed to the GMapOptions object literal when the
map is constructed, and are used to construct the GoogleBar control when
GMap2.enableGoogleBar() is called.(Since 2.95) |
backgroundColor
|
String |
This property specifies the color to display behind the map tiles.
The color can be any valid W3C standard color value. (Since 2.119) |
These constants define the stacking order (z-order) used by the map and objects on the map for display purposes. Each pane defines a set of similar display objects to show on the map, and each pane defines a unique z-order on the map. Panes with a higher z-order are shown "on top" of panes with a lower z-order. (Note that objects within a given pane may exhibit their own z-order precedence as well; some object may appear on top of other objects within that pane.)
You need to use these constants if you subclass from
GOverlay, so that you can place your custom overlay
in one of the panes.
The following constants are listed in order from lowest z-order (bottom) to the highest (top).
| Constant | Description |
|---|---|
G_MAP_MAP_PANE
|
This pane is the lowest pane and is above the tiles. |
G_MAP_OVERLAY_LAYER_PANE
|
This pane contains polylines, polygons, ground overlays and tile layer overlays.
(Since 2.127) |
G_MAP_MARKER_SHADOW_PANE
|
This pane contains the marker shadows. |
G_MAP_MARKER_PANE
|
This pane contains the marker foreground images. |
G_MAP_FLOAT_SHADOW_PANE
|
This pane contains the info window shadow. It is
above the G_MAP_MARKER_PANE, so that markers can be
in the shadow of the info window. |
G_MAP_MARKER_MOUSE_TARGET_PANE
|
This pane contains transparent elements that receive DOM
mouse events for the markers. Is is above the
G_MAP_FLOAT_SHADOW_PANE, so that markers in the
shadow of the info window can be clickable. |
G_MAP_FLOAT_PANE
|
This pane contains the info window. It is above all map overlays. |
A GPoint represents a point on the
map by its pixel coordinates. Notice that in v2, it doesn't
represent a point on the earth by its geographical coordinates
anymore. Geographical coordinates are now represented by
GLatLng.
In the Google Maps coordinate system, the x
coordinate increases to the right, and the y coordinate
increases downwards, though you may use GPoint
coordinates however you wish.
Notice that while the two parameters of a
GPoint are accessible as properties x and
y, it is better to never modify them, but to create a new
object with different paramaters instead.
| Constructor | Description |
|---|---|
GPoint(x:Number,
y:Number)
|
Creates a GPoint object. |
| Property | Type | Description |
|---|---|---|
x
|
Number |
x coordinate. (This value increases to the right in the Google Maps coordinate system.) |
y
|
Number |
y coordinate. (This value increases downwards in the Google Maps coordinate system.) |
| Method | Return Value | Description |
|---|---|---|
equals(other:GPoint)
|
Boolean |
Returns true iff the other point has equal
coordinates. |
toString()
|
String |
Returns a string that contains the x and y coordinates, in this order, separated by a comma. |
| Constant | Description |
|---|---|
ORIGIN
|
The constant new GPoint(0, 0). |
A GSize is the size in pixels of a
rectangular area of the map. The size object has two parameters,
width and height. Width is a difference in
the x-coordinate; height is a difference in the y-coordinate, of
points.
Notice that while the two parameters of a
GSize are accessible as properties width
and height, it is better to never modify them, but to
create a new object with different paramaters instead.
| Constructor | Description |
|---|---|
GSize(width:Number,
height:Number)
|
Creates a GSize object. |
| Property | Type | Description |
|---|---|---|
width
|
Number |
The width parameter. |
height
|
Number |
The height parameter. |
| Method | Return Value | Description |
|---|---|---|
equals(other:GSize)
|
Boolean |
Returns true iff the other size has exactly
equal components. |
toString()
|
String |
Returns a string that contains the wdith and height parameter, in this order, separated by a comma. |
| Constant | Description |
|---|---|
ZERO
|
The constant new GSize(0, 0). |
You can call this function to cause the map API to
cleanup internal data structures to release memory. This helps you
to work around various browser bugs that cause memory leaks in web
applications. You should call this function in the
unload event handler of your page. After this function
was called, the map objects that you've created in this page will be
dysfunctional.
| Method | Return Value | Description |
|---|---|---|
GUnload()
|
None |
Dismantles all registered event handlers in order to prevent
memory leaks. Should be called as a handler for the
unload event. |
This constant specifies the version of the API currently being served to your page. For more information about version, read API Updates.
| Method | Return Value | Description |
|---|---|---|
()
|
None |
Returns the version of the API currently being served to your page. |
This namespace contains functions that you use to
register event handlers, both for custom events and for DOM events,
and to fire custom events. All the events defined by this API are
custom events that are internally fired by
GEvent.trigger().
| Method | Return Value | Description |
|---|---|---|
GEvent.addListener(source:Object,
event:String,
handler:Function)
|
GEventListener |
Registers an event handler for a custom event on the source
object. Returns a handle that can be used to eventually
deregister the handler. The event handler will be called with
this set to the source object. |
GEvent.addDomListener(source:Node,
event:String,
handler:Function)
|
GEventListener |
Registers an event handler for a DOM event on the source
object. The source object must be a DOM Node. Returns a handle
that can be used to eventually deregister the handler. The event
handler will be called with this set to the source
object. This function uses the DOM methods for the current
browser to register the event handler. |
GEvent.removeListener(handle:GEventListener)
|
None |
Removes a handler that was installed using
addListener() or addDomListener(). |
GEvent.clearListeners(source:Object or Node,
event:String)
|
None |
Removes all handlers on the given object for the given event
that were installed using addListener() or
addDomListener(). |
GEvent.clearInstanceListeners(source:Object or Node)
|
None |
Removes all handlers on the given object for all events that
were installed using addListener() or
addDomListener(). |
GEvent.clearNode(source:Node)
|
None |
Calls clearInstanceListeners on a node and all of its
child nodes, recursively. |
GEvent.trigger(source:Object,
event:String,
...)
|
None |
Fires a custom event on the source object. All remaining
optional arguments after event are passed in turn
as arguments to the event handler functions. |
GEvent.bind(source:Object,
event:String,
object:Object,
method:Function)
|
GEventListener |
Registers an invocation of the method on the given object as the event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler. |
GEvent.bindDom(source:Node,
event:String,
object:Object,
method:Function)
|
GEventListener |
Registers an invocation of the method on the given object as the event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler. |
GEvent.callback(object:Object,
method:Function)
|
Function |
Returns a closure that calls method on
object. |
GEvent.callbackArgs(object:Object,
method:Function,
...)
|
Function |
Returns a closure that calls method on
object. All remaining optional arguments after
method are passed in turn as arguments to the
method when the returned function is invoked. |
| Event | Description |
|---|---|
clearlisteners(event?:String)
|
This event is fired on object when
clearListeners() or
clearInstanceListeners() is called on that
object. Of course, the event is fired before the
functions are executed. |
This class is opaque. It has no methods and no
constructor. Its instances are returned from
GEvent.addListener() or
GEvent.addDomListener() and are eventually passed back
to GEvent.removeListener().
This interface is implemented by all controls. You
can implement it in order to provide a custom control for the
map. Controls are added to the map using the
GMap2.addControl() method.
In contrast to overlays, which are positioned relative to the map, controls are positioned relative to the map view, i.e. they don't move when the map moves.
| Constructor | Description |
|---|---|
GControl(printable?:Boolean,
selectable?:Boolean)
|
Creates the prototype instance for a new control class. Flag
printable indicates that the control should be
visible in the print output of the map. Flag
selectable indicates that the control will contain
text that should be selectable. |
These methods will be called by the map when the
control is added to the map using
GMap2.addControl(). Thus, these methods will not be
called by you, but they will be implemented by
you.
| Method | Return Value | Description |
|---|---|---|
printable()
|
Boolean |
Returns to the map if the control should be printable. |
selectable()
|
Boolean |
Returns to the map if the control contains selectable text. |
initialize(map:GMap2)
|
Node |
Will be called by the map so the control can initialize
itself. The control will use the method
GMap2.getContainer() to get hold of the DOM element
that contains the map, and add itself to it. It returns the
added element. |
getDefaultPosition()
|
GControlPosition |
Returns to the map the position in the map view at which the
control appears by default. This will be overridden by the
second argument to GMap2.addControl(). |
| Constant | Description |
|---|---|
G_ANCHOR_TOP_RIGHT
|
The control will be anchored in the top right corner of the map. |
G_ANCHOR_TOP_LEFT
|
The control will be anchored in the top left corner of the map. |
G_ANCHOR_BOTTOM_RIGHT
|
The control will be anchored in the bottom right corner of the map. |
G_ANCHOR_BOTTOM_LEFT
|
The control will be anchored in the bottom left corner of the map. |
These implementations of interface
GControl are available.
| Constructor | Description |
|---|---|
GSmallMapControl()
|
Creates a control with buttons to pan in four directions, and zoom in and zoom out. |
GLargeMapControl()
|
Creates a control with buttons to pan in four directions, and zoom in and zoom out, and a zoom slider. |
GSmallZoomControl()
|
Creates a control with buttons to zoom in and zoom out. |
GLargeMapControl3D()
|
Creates a new 3D-style control with buttons to pan in four
directions, and zoom in and zoom out, and a zoom slider. When the map
first becomes rotatable, the GLargeMapControl3D will shift
its position to accomodate a compass ring that can be rotated to change
the current map type to one with a different heading. |
GSmallZoomControl3D()
|
Creates a new 3D-style control with buttons to zoom in and zoom out. |
GScaleControl()
|
Creates a control that displays the map scale. |
GMapTypeControl()
|
Creates a standard map type control for selecting and switching between supported map types via buttons. |
GMenuMapTypeControl()
|
Creates a drop-down map type control for switching between supported map types. |
GHierarchicalMapTypeControl()
|
Creates a "nested" map type control for selecting and switching between supported map types via buttons and nested checkboxes. |
GOverviewMapControl()
|
Creates a collapsible overview mini-map in the corner of the main
map for reference location and navigation (through dragging). The
GOverviewMapControl creates an overview map with a
one-pixel black border.
Note: Unlike other controls, you can only place this control in the
bottom right corner of the map (G_ANCHOR_BOTTOM_RIGHT).
|
GNavLabelControl()
|
Creates a dynamic "breadcrumb" label indicating the address of the
current viewport as a series of nested address components. This control
additionally provides navigation links to each of the individual
address subcomponents.
(Since 2.141) |
This class described the position of a control in
the map view. It consists of a corner relative to where the control
is positioned, and an offset that determines this position. It can be
passed as optional argument position to the method
GMap2.addControl(), and it is returned from method
GControl.getDefaultPosition().
| Constructor | Description |
|---|---|
GControlPosition(anchor:enum GControlAnchor,
offset:GSize)
|
Creates a specification for a control position. |
The GHierarchicalMapTypeControl provides
a "nested" map type control for selecting and switching
between supported map types via buttons and nested checkboxes.
Controls will be made available for all map types currently attached
to the map at the time the control is constructed.
Map types added to the map appear as buttons as in the normal
GMapTypeControl. However, map types set as sub-types of
other map types (see the addRelationship() method below)
will appear as checkbox sub-menu items below the parent button.
By default, maps support the set of G_DEFAULT_MAP_TYPES,
though maps may also add map types explicitly via
GMap2.addMapType(). Controls will be made
available for all map types currently attached to the map at the time the
control is constructed. Note that because sub-types appear as checkboxes,
you can toggle their appearance with their parents or their siblings in the
sub-menu.
| Constructor | Description |
|---|---|
GHierarchicalMapTypeControl()
|
Constructs the control. By default, the G_HYBRID_MAP
map type is made a child of the G_SATELLITE_MAP map type.
If this is not desired, the relationship can be removed by calling the
clearRelationships() method. |
| Method | Return Value | Description |
|---|---|---|
addRelationship(parentType:GMapType,
childType:GMapType,
childText?:String,
isDefault?:Boolean)
|
None |
Registers a parent/child relationship between map types with the
control. If childText is given, it will be displayed next
to the checkbox for the child map type instead of its name. If
isDefault is true, the child map type will be selected by
default. Note that all relationships must be set up before the control
is added. (Adding relationships after the control is added will have
no effect.)(Since 2.94) |
removeRelationship(mapType:GMapType)
|
None |
Removes all relationships involving a map type from the control. (Since 2.94) |
clearRelationships()
|
None |
Removes all relationships from the control. (Since 2.94) |
Google provides some predefined map types - this class
is used to define custom ones. In order to show them on the
map, use the GMap2 constructor, or the
GMap2.addMapType() method. See also
GTileLayerOverlay to add to (rather than entirely replace)
the map's tile layers.
This class can also be subclassed. Constructor
arguments can be omitted if instantiated as a prototype. A subclass
constructor must invoke the GMapType constructor using
call().
| Constructor | Description |
|---|---|
GMapType(layers:GTileLayer[],
projection:GProjection,
name:String,
opts?:GMapTypeOptions)
|
Constructs a map type with the given tile layers, projection, name, and optional parameters. |
These methods are mostly called by the map that
this maptype is passed to, but some methods may also be called from
outside the map, e.g. getBoundsZoomLevel().
| Method | Return Value | Description |
|---|---|---|
getSpanZoomLevel(center:GLatLng,
span:GLatLng,
viewSize:GSize)
|
Number |
Returns to the map the zoom level at which the map section defined by center and span fits into the map view of the given size in pixels. |
getBoundsZoomLevel(bounds:GLatLngBounds,
viewSize:GSize)
|
None |
Returns to the map the zoom level at which the map section defined by bounds fits into the map view of the given size in pixels. |
getName(short?:Boolean)
|
String |
Returns to the map the name of the map type to be used as
the button label in the GMapTypeControl. |
getProjection()
|
GProjection |
Returns to the map the projection of this map type. |
getTileSize()
|
Number |
Returns to the map the map tile size in pixels of this map type. The tiles are assumed to be quadratic. All tile layers have the same tile size. |
getTileLayers()
|
GTileLayer[] |
Returns to the map the array of tile layers. |
getMinimumResolution()
|
Number |
Returns to the map the lowest zoom level at which this map type is defined. |
getMaximumResolution()
|
Number |
Returns to the map the highest zoom level at which this map type is defined. |
getMaxZoomAtLatLng(latlng:GLatLng,
callback:Function,
opt_targetZoom:number)
|
None |
Sends a request to Google servers to find the maximum zoom level for
which imagery exists for this map type at the given GLatLng. The
callback function will be invoked with a response containing a
status code, and if successful, a zoom value
for the maximum zoom level. If opt_targetZoom is set, only zoom levels
up to opt_targetZoom will be considered. Note: this feature is only
implemented for satellite imagery, for the G_SATELLITE_MAP
map type and the G_HYBRID_MAP map type.(Since 2.158) |
getTextColor()
|
String |
Returns to the map the color that is best used for text that is overlaid on the map. Used for the color of the text of the copyright message displayed by the copyright control. |
getLinkColor()
|
String |
Returns to the map the color that is best used for a hyperlink that is overlaid on the map. Used for the color of the link to the terms of use displayed by the copyright control. |
getErrorMessage()
|
String |
Returns to the map the error message that is displayed in areas or on zoom level where this map type doesn't have map tiles. |
getCopyrights(bounds:GLatLngBounds,
zoom:Number)
|
String[] |
Returns to the map the copyright messages appropriate
for the region described by bounds at the given
zoom level. This is used by the copyright message on
the map. |
getUrlArg()
|
String |
Returns to the map a value that is used as a URL paramater value to identify this map type in permalinks to the current map view. This is currently only used by the maps application. |
getAlt()
|
String |
Returns to the map the alternative text of this map type. (Since 2.86) |
getHeading()
|
Number |
Returns the heading of this map type. Heading is defined as the
viewing angle of the map type, measured clockwise in degrees from grid
north, which is 0. (Since 2.193) |
| Constant | Description |
|---|---|
G_NORMAL_MAP
|
This map type (which is the default) displays a normal street map. |
G_SATELLITE_MAP
|
This map type displays satellite images. |
G_AERIAL_MAP
|
This map type displays aerial imagery. (Since 2.193) |
G_HYBRID_MAP
|
This map type displays a transparent layer of major streets on satellite images. |
G_AERIAL_HYBRID_MAP
|
This map type displays a transparent layer of major streets on top of
aerial imagery. (Since 2.193) |
G_PHYSICAL_MAP
|
This map type displays maps with physical features such
as terrain and vegetation. This map type is not displayed
within map type controls by default. (Since 2.94) |
G_MAPMAKER_NORMAL_MAP
|
This map type displays a street map with tiles created using
Google Mapmaker.
Note: When you use a Mapmaker map type, users will only see maps in countries where Google Map Maker is launched. (Since 2.145) |
G_MAPMAKER_HYBRID_MAP
|
This map type displays a transparent layer of major streets
created using
Google Mapmaker on satellite images.
Note: When you use the Mapmaker maptype, users will only see maps in countries where Google Map Maker is launched. (Since 2.145) |
G_MOON_ELEVATION_MAP
|
This map type displays a shaded terrain map of the surface of the Moon, color-coded by altitude.
This map type is not displayed within map type controls by default. (Since 2.95) |
G_MOON_VISIBLE_MAP
|
This map type displays photographs taken from orbit around the moon. This map type is not
displayed within map type controls by default. (Since 2.95) |
G_MARS_ELEVATION_MAP
|
This map type displays a shaded relief map of the surface of Mars, color-coded by altitude.
This map type is not displayed within map type controls by default. (Since 2.95) |
G_MARS_VISIBLE_MAP
|
This map type displays photographs taken from orbit around Mars.
This map type is not displayed within map type controls by default. (Since 2.95) |
G_MARS_INFRARED_MAP
|
This map type displays a shaded infrared map of the surface of Mars, where
warmer areas appear brighter and colder areas appear darker.
(Since 2.95) |
G_SKY_VISIBLE_MAP
|
This map type shows a mosaic of the sky, covering the full celestial sphere.
(Since 2.95) |
G_SATELLITE_3D_MAP
|
This map type, in conjunction with the
Google Earth Browser Plug-in, displays a fully interactive 3D model of the Earth with
satellite imagery. This map type is not displayed within map type controls by default.
Adding this map type to your map not only adds a control for the Google Earth map type, but also handles initialization of the map type once a user clicks on the control. If a user currently does not have the Google Earth Plug-in installed in their browser, the first time a user selects this map type, the user will be prompted to download and install the Plug-in and restart their browser. For users that have already installed the plugin, selecting this map type will create an Earth instance for the map and display a 3D view of the Earth. You may use GMap2.getEarthInstance() to retrieve this Earth instance and manipulate it using the
Google Earth API.
Currently, markers, infowindows, and polylines work with this 3D map type, but other features are not yet supported. We plan to add support for more features in future releases. (Since 2.113) |
G_DEFAULT_MAP_TYPES
|
An array of the first three predefined map types described above (G_NORMAL_MAP, G_SATELLITE_MAP, and G_HYBRID_MAP). |
G_MAPMAKER_MAP_TYPES
|
An array of the Mapmaker map types described above (G_MAPMAKER_NORMAL_MAP, G_SATELLITE_MAP, and G_MAPMAKER_HYBRID_MAP). |
G_MOON_MAP_TYPES
|
An array of the two Moon types defined above (G_MOON_ELEVATION_MAP and G_MOON_VISIBLE_MAP). |
G_MARS_MAP_TYPES
|
An array of the three Mars map types defined above (G_MARS_ELEVATION_MAP, G_MARS_VISIBLE_MAP, and G_MARS_INFRARED_MAP). |
G_SKY_MAP_TYPES
|
An array of the one sky map type defined above (G_SKY_VISIBLE_MAP). |
| Event | Description |
|---|---|
newcopyright(copyright:GCopyright)
|
This event is fired when a new copyright is added to the copyright collection of one of the tile layers contained in this map type. |
A GMapTypeControl provides a control for
selecting and switching between supported map types via buttons. Controls
will be made available for all map types currently attached to the map
at the time the control is constructed.
By default, maps support the set of
G_DEFAULT_MAP_TYPES; maps may also add map types
explicitly via GMap2.addMapType(). To conserve space on
the map, you may instead use a GHierarchicalMapTypeControl
to display "nested" map types or GMenuMapTypeControl to display
a drop-down of map types.
| Constructor | Description |
|---|---|
GMapTypeControl(useShortNames?:Boolean)
|
Creates a GMapTypeControl, using the short (alt) names
for the map types if useShortNames is set to true, and the long
names by default. |
Instances of this class are used as the
opts? argument to the GMapType
constructor. There is no constructor for this class. Instead, this
class is instantiated as a javascript object literal.
| Property | Type | Description |
|---|---|---|
shortName
|
String |
Sets the short name of the map type that is returned from
GMapType.getName(true). Default is the same as the
name. |
urlArg
|
String |
Sets the url argument of the map type that is returned from
GMapType.getUrlArg(). Default is the empty
string. |
maxResolution
|
Number |
Sets the maximum zoom level of this map type, returned by
GMapType.getMaximumResolution(). Default is the maximum
of all tile layers. |
minResolution
|
Number |
Sets the minimum zoom level of this map type, returned by
GMapType.getMinimumResolution(). Default is the minimum
of all tile layers. |
tileSize
|
Number |
Set the tile size returned by
GMapType.getTileSize(). Default is
256. |
textColor
|
String |
Sets the text color returned by
GMapType.getTextColor(). Default is
"black". |
linkColor
|
String |
Sets the text color returned by
GMapType.getLinkColor(). Default is
"#7777cc". |
errorMessage
|
String |
Sets the error message returned by
GMapType.getErrorMessage(). Default is the empty
string. |
alt
|
String |
Sets the alternative text to the map type returned by
GMapType.getAlt(). Default is the empty string.(Since 2.64) |
radius
|
Number |
Sets the radius of the map type given the passed Number
measured in meters. The default value is 6378137, the equatorial radius of the Earth
in meters.(Since 2.89) |
heading
|
Number |
This property contains the heading of the map type in degrees. Default
is 0. (Since 2.193) |
This class represents a set of UI options for the Map
| Constructor | Description |
|---|---|
GMapUIOptions(opt_size:GSize)
|
Instantiates a set of UI options, with values set to defaults suitable for a map of the given size. A "small" map is one which is smaller than 400 pixels wide or 300 pixels high. A "large" map is any map 400x300 or larger. |
| Property | Type | Description |
|---|---|---|
maptypes.normal
|
Boolean |
When set to true, this property specifies that the normal MapType
(G_NORMAL_MAP) should be added to the Map. True by default.
(Since 2.147) |
maptypes.satellite
|
Boolean |
When set to true, this property specifies that the satellite MapType
(G_SATELLITE_MAP) should be added to the Map. True by default.
(Since 2.147) |
maptypes.hybrid
|
Boolean |
When set to true, this property specifies that the hybrid MapType
(G_HYBRID_MAP) should be added to the Map. True by default.
(Since 2.147) |
maptypes.physical
|
Boolean |
When set to true, this property specifies that the physical (terrain)
MapType (G_PHYSICAL_MAP) should be added to the Map.
True by default.
(Since 2.147) |
zoom.scrollwheel
|
Boolean |
When set to true, this property specifies that zooming with the
scrollwheel should be enabled. True by default.
(Since 2.147) |
zoom.doubleclick
|
Boolean |
When set to true, this property specifies that zooming with
double-clicks should be enabled. True by default.
(Since 2.147) |
keyboard
|
Boolean |
When set to true, this property specifies that GKeyboardHandler
should be enabled for the Map. True by default.
(Since 2.147) |
controls.largemapcontrol3d
|
Boolean |
When set to true, this property specifies that a
GLargeMapControl3D should be added to the Map.
True by default for "large" maps.
(Since 2.147) |
controls.smallzoomcontrol3d
|
Boolean |
When set to true, this property specifies that a
GSmallZoomControl3D should be added to the Map.
True by default for "small" maps.
(Since 2.147) |
controls.maptypecontrol
|
Boolean |
When set to true, this property specifies that a
GMapTypeControl should be added to the Map.
True by default for "large" maps.
(Since 2.147) |
controls.menumaptypecontrol
|
Boolean |
When set to true, this property specifies that a
GMenuMapTypeControl should be added to the Map.
True by default for "small" maps.
(Since 2.147) |
controls.scalecontrol
|
Boolean |
When set to true, this property specifies that a
GScaleControl should be added to the Map.
True by default for "large" maps.
(Since 2.147) |
A GMenuMapTypeControl provides a control for
selecting and switching between supported map types via a drop-down menu. Controls
will be made available for all map types currently attached to the map
at the time the control is constructed.
By default, maps support the set of
G_DEFAULT_MAP_TYPES; maps may also add map types
explicitly via GMap2.addMapType().
| Constructor | Description |
|---|---|
GMenuMapTypeControl(useShortNames?:Boolean)
|
Creates a GMenuMapTypeControl, using the short (alt) names
for the map types if useShortNames is set to true, and the long
names by default. |
A GNavLabelControl provides a control for a
dynamic "breadcrumb" label indicating the address of the current viewport as
a series of nested address components. This control additionally provides
navigation links to each of the individual address subcomponents.
By default, this control lies in the top-right corner of the viewport. It will hide after 10 seconds idle and show on a click or viewport change on the map. It also hides if the address of current viewport is not avaliable.
| Constructor | Description |
|---|---|
GNavLabelControl()
|
Creates a GNavLabelControl.(Since 2.141) |
| Method | Return Value | Description |
|---|---|---|
setMinAddressLinkLevel(level:Number)
|
None |
Set the minimal level of address which has a link in the label. For
example, show address links for all addresses in "USA > NY >
Brooklyn" for level 0, and show address link only for "Brooklyn" if
level is 2. The default level is 0. (Since 2.162) |
A copyright object contains information about which copyright message applies to a region of the map given by a rectangle, at a given zoom level. You need this object only if you implement custom map types or tile layers.
| Constructor | Description |
|---|---|
GCopyright(id:Number,
bounds:GLatLngBounds,
minZoom:Number,
text:String)
|
Creates a copyright information object with the given properties. |
| Property | Type | Description |
|---|---|---|
id
|
Number |
A unique identifier for this copyright information. |
minZoom
|
Number |
The lowest zoom level at which this information applies. |
bounds
|
GLatLngBounds |
The region to which this information applies. |
text
|
String |
The text of the copyright message. |
You use this class to manage copyright messages displayed on maps of custom map type. If you don't implement custom map types, then you don't need to use this class. A copyright collection contains information about which copyright to display for which region on the map at which zoom level. This is very important for map types that display heterogenous data such as the satellite map type.
| Constructor | Description |
|---|---|
GCopyrightCollection(prefix?:String)
|
Copyright messages produced from this copyright collection
will have the common prefix given as the argument. Example: "Imagery (C) 2006" |
| Method | Return Value | Description |
|---|---|---|
addCopyright(copyright:GCopyright)
|
None |
Adds a copyright information object to the collection. |
getCopyrights(bounds:GLatLngBounds,
zoom:Number)
|
String[] |
Returns all copyright strings that are pertinent
for the given map region at the given zoom level. Example: [ "Google", "Keyhole" ] |
getCopyrightNotice(bounds:GLatLngBounds,
zoom:Number)
|
String |
Returns the prefix and all relevant copyright strings
that are pertinent for the given map region at the given zoom level. Example: "Imagery (C) 2006 Google, Keyhole" |
| Event | Description |
|---|---|
newcopyright(copyright:GCopyright)
|
This event is fired when a new copyright was added to this copyright collection. |
This object creates a rectangular image overlay on the
map, whose boundaries are defined by GLatLngBounds.
| Constructor | Description |
|---|---|
GGroundOverlay(imageUrl:String,
bounds:GLatLngBounds)
|
Creates a ground overlay from an image URL and its bounds. (Since 2.79) |
| Method | Return Value | Description |
|---|---|---|
hide()
|
None |
Hides the ground overlay if it is currently visible. Note
that this function triggers the event
GGroundOverlay.visibilitychanged in case the ground
overlay is currently visible.(Since 2.87) |
isHidden()
|
Boolean |
Returns true if the ground overlay is currently
hidden. Otherwise returns false. (Since 2.87) |
show()
|
None |
Shows the ground overlay if it is currently hidden. Note
that this function triggers the event
GGroundOverlay.visibilitychanged in case the ground
overlay is currently hidden.(Since 2.87) |
supportsHide()
|
Boolean |
Always returns true.(Since 2.87) |
| Event | Description |
|---|---|
visibilitychanged(isVisible:Boolean)
|
This event is fired when the visibility state of the ground
overlay toggles from visible to hidden or vice versa. The
isVisible argument reflects the state of the ground
overlay after completion of this visibility state.
(Since 2.77) |
An icon specifies the images used to display a
GMarker on the map. For browser compatibility reasons,
specifying an icon is actually quite complex. Note that you can use
the default Maps icon G_DEFAULT_ICON if you don't want
to specify your own.
| Constructor | Description |
|---|---|
GIcon(copy?:GIcon,
image?:String)
|
Creates a new icon object. If another icon is given in the
optional copy argument, its properties are copied,
otherwise they are left empty. The optional argument
image sets the value of the image
property. |
| Constant | Description |
|---|---|
G_DEFAULT_ICON
|
The default icon used by markers. |
| Property | Type | Description |
|---|---|---|
image
|
String |
The foreground image URL of the icon. |
shadow
|
String |
The shadow image URL of the icon. |
iconSize
|
GSize |
The pixel size of the foreground image of the icon. |
shadowSize
|
GSize |
The pixel size of the shadow image. |
iconAnchor
|
GPoint |
The pixel coordinate relative to the top left corner of the icon image at which this icon is anchored to the map. |
infoWindowAnchor
|
GPoint |
The pixel coordinate relative to the top left corner of the icon image at which the info window is anchored to this icon. |
printImage
|
String |
The URL of an alternate foreground icon image used for
printing on browsers incapable of handling the default
GIcon.image. Versions of IE typically require
an alternative image in these cases as they cannot print the
icons as transparent PNGs. Note that browsers capable of
printing the default image will ignore this
property. |
mozPrintImage
|
String |
The URL of an alternate non-transparent icon image used
for printing on browsers incapable of handling either
transparent PNGs (provided in the default
GIcon.image) or transparent GIFs (provided in
GIcon.printImage). Older versions of
Firefox/Mozilla typically require non-transparent images for
printing. Note that browsers capable of printing the default
image will ignore this property. |
printShadow
|
String |
The URL of the shadow image used for printed maps. It should be a GIF image since most browsers cannot print PNG images. |
transparent
|
String |
The URL of a virtually transparent version of the foreground icon image used to capture click events in Internet Explorer. This image should be a 24-bit PNG version of the main icon image with 1% opacity, but the same shape and size as the main icon. |
imageMap
|
Number[] |
An array of integers representing the x/y coordinates of the image map we should use to specify the clickable part of the icon image in browsers other than Internet Explorer. |
maxHeight
|
Integer |
Specifies the distance in pixels in which a marker will visually
"rise" vertically when dragged. (Since 2.79) |
dragCrossImage
|
String |
Specifies the cross image URL when an icon is dragged. (Since 2.79) |
dragCrossSize
|
GSize |
Specifies the pixel size of the cross image when an icon
is dragged. (Since 2.79) |
dragCrossAnchor
|
GPoint |
Specifies the pixel coordinate offsets (relative to the iconAnchor)
of the cross image when an icon is dragged. (Since 2.79) |
This class instantiates a predefined "layer" overlay consisting of
a collection of related items.
It implements the GOverlay interface and thus is added to the map using the
GMap2.addOverlay() method.
| Constructor | Description |
|---|---|
GLayer(layerId:String)
|
Creates a layer using the given unique Layer ID. http://spreadsheets.google.com/pub?key=p9pdwsai2hDN-cAocTLhnag contains a list of the currently supported layers. |
| Method | Return Value | Description |
|---|---|---|
hide()
|
None |
Hides this overlay so it is not visible, but maintains its position in the stack of overlays. |
show()
|
None |
Shows a previously hidden GLayer. |
| Method | Return Value | Description |
|---|---|---|
GLayer.isHidden(layerId:String)
|
None |
Returns true if the layer overlay is hidden or was not
added to the map using the GMap2.addOverlay() method.
Otherwise returns false. |
A GMarker marks a position on the
map. It implements the GOverlay interface and thus is
added to the map using the GMap2.addOverlay()
method.
A marker object has a latlng, which is
the geographical position where the marker is anchored on the map,
and an icon. If the icon is not set in the
constructor, the default icon G_DEFAULT_ICON is
used.
After it is added to a map, the info window of that map can be opened through the marker. The marker object will fire mouse events and infowindow events.
| Constructor | Description |
|---|---|
GMarker(latlng:GLatLng,
icon?:GIcon,
inert?:Boolean)
|
Creates a marker at the passed latlng of either GPoint or GLatLng with
icon or the G_DEFAULT_ICON. If the
inert flag is true, then the marker is
not clickable and will not fire any events.(Deprecated since 2.50) |
GMarker(latlng:GLatLng,
opts?:GMarkerOptions)
|
Creates a marker at the latlng with options
specified in GMarkerOptions. By default markers are
clickable & have the default icon
G_DEFAULT_ICON.(Since 2.50) |
Before these methods can be invoked, the marker must be added to a map.
| Method | Return Value | Description |
|---|---|---|
openInfoWindow(content:Node,
opts?:GInfoWindowOptions)
|
None |
Opens the map info window over the icon of the marker. The
content of the info window is given as a DOM node. Only
option GInfoWindowOptions.maxWidth is
applicable. |
openInfoWindowHtml(content:String,
opts?:GInfoWindowOptions)
|
None |
Opens the map info window over the icon of the marker. The
content of the info window is given as a string that contains
HTML text. Only option
GInfoWindowOptions.maxWidth is applicable. |
openInfoWindowTabs(tabs:GInfoWindowTab[],
opts?:GInfoWindowOptions)
|
None |
Opens the tabbed map info window over the icon of the
marker. The content of the info window is given as an array of
tabs that contain the tab content as DOM nodes. Only
options GInfoWindowOptions.maxWidth and
InfoWindowOptions.selectedTab are applicable. |
openInfoWindowTabsHtml(tabs:GInfoWindowTab[],
opts?:GInfoWindowOptions)
|
None |
Opens the tabbed map info window over the icon of the
marker. The content of the info window is given as an array of
tabs that contain the tab content as Strings that contain
HTML text. Only options
InfoWindowOptions.maxWidth and
InfoWindowOptions.selectedTab are applicable. |
bindInfoWindow(content:Node,
opts?:GInfoWindowOptions)
|
None |
Binds the given DOM node to this marker. The content within this node
will be automatically displayed in the info window when the marker is
clicked. Pass content as null to unbind.(Since 2.85) |
bindInfoWindowHtml(content:String,
opts?:GInfoWindowOptions)
|
None |
Binds the given HTML to this marker. The HTML content
will be automatically displayed in the info window when the marker is
clicked. Pass content as null to unbind.(Since 2.85) |
bindInfoWindowTabs(tabs:GInfoWindowTab[],
opts?:GInfoWindowOptions)
|
None |
Binds the given GInfoWindowTabs (provided as DOM nodes) to this marker.
The content within these tabs' nodes will be automatically
displayed in the info window when the marker is clicked.
Pass tabs as null to unbind.(Since 2.85) |
bindInfoWindowTabsHtml(tabs:GInfoWindowTab[],
opts?:GInfoWindowOptions)
|
None |
Binds the given GInfoWindowTabs (provided as strings of HTML) to this marker.
The HTML content within these tabs will be automatically displayed in the info
window when the marker is clicked. Pass tabs as null
to unbind.(Since 2.85) |
closeInfoWindow()
|
None |
Closes the info window only if it belongs to this marker. (Since 2.85) |
showMapBlowup(opts?:GInfoWindowOptions)
|
None |
Opens the map info window over the icon of the marker. The
content of the info window is a closeup map around the marker
position. Only options InfoWindowOptions.zoomLevel
and InfoWindowOptions.mapType are applicable. |
getIcon()
|
GIcon |
Returns the icon of this marker, as set by the
constructor. |
getTitle()
|
String |
Returns the title of this marker, as set by the constructor
via the GMarkerOptions.title property. Returns
"undefined" if no title is passed in.(Since 2.85) |
getPoint()
|
GLatLng |
Returns the geographical coordinates at which
this marker is anchored, as set by the constructor or by
setPoint().(Deprecated since 2.88) |
getLatLng()
|
GLatLng |
Returns the geographical coordinates at which
this marker is anchored, as set by the constructor or by
setLatLng().(Since 2.88) |
setPoint(latlng:GLatLng)
|
None |
Sets the geographical coordinates of the point at which this
marker is anchored. (Deprecated since 2.88) |
setLatLng(latlng:GLatLng)
|
None |
Sets the geographical coordinates of the point at which this
marker is anchored. (Since 2.88) |
enableDragging()
|
None |
Enables the marker to be dragged and dropped around the map.
To function, the marker must have been initialized with
GMarkerOptions.draggable = true. |
disableDragging()
|
None |
Disables the marker from being dragged and dropped around the map. |
draggable()
|
Boolean |
Returns true if the marker has been initialized via the
constructor using GMarkerOptions.draggable =
true. Otherwise, returns false.
|
draggingEnabled()
|
Boolean |
Returns true if the marker is currently enabled for the user
to drag on the map.
|
setImage(url:String)
|
None |
Requests the image specified by the url to be set as
the foreground image for this marker. Note that neither the
print image nor the shadow image are adjusted. Therefore this method
is primarily intended to implement highlighting or dimming effects,
rather than drastic changes in marker's appearances.
(Since 2.75) |
hide()
|
None |
Hides the marker if it is currently visible. Note that this
function triggers the event GMarker.visibilitychanged in
case the marker is currently visible. (Since 2.77) |
show()
|
None |
Shows the marker if it is currently hidden. Note that this
function triggers the event GMarker.visibilitychanged in
case the marker is currently hidden. (Since 2.77) |
isHidden()
|
Boolean |
Returns true if the marker is currently hidden. Otherwise returns
false. (Since 2.77) |
All these events fire only if the marker is not inert (see constructor).
| Event | Description |
|---|---|
click(latlng:GLatLng)
|
This event is fired when the marker icon was clicked, passing in the
current coordinate of the marker within its latlng argument.
Notice that this event will also fire for the map, with the marker
passed as the first argument to the event handler there. |
dblclick(latlng:GLatLng)
|
This event is fired when the marker icon was double-clicked, passing in
the current coordinate of the marker within its latlng argument.
Notice that this event will not fire
for the map, because the map centers on double-click as a
hardwired behavior. |
mousedown(latlng:GLatLng)
|
This event is fired when the DOM mousedown event is fired on
the marker icon, passing in the current coordinate of the marker
within its latlng argument.
Notice that the marker will stop the mousedown DOM event,
so that it doesn't cause the map to start dragging. |
mouseup(latlng:GLatLng)
|
This event is fired for the DOM mouseup on the
marker, and passing in the current coordinate of the marker
within its latlng argument.
Notice that the marker will not stop the
mousedown DOM event, because it will not confuse the drag
handler of the map. |
mouseover(latlng:GLatLng)
|
This event is fired when the mouse enters the area of the
marker icon, passing in the current coordinate of the marker
within its latlng argument. |
mouseout(latlng:GLatLng)
|
This event is fired when the mouse leaves the area of the
marker icon, passing in the current coordinate of the marker
within its latlng argument. |
infowindowopen()
|
This event is fired when the info window of the map was opened through this marker. |
infowindowbeforeclose()
|
This event is fired before the info window of the map that was
opened through this marker is closed. (Since 2.83) |
infowindowclose()
|
This event is fired when the info window of the map that was
opened through this marker is closed. This happens when either the
info window was closed, or when it was opened on another
marker, or on the map. The event infowindowbeforeclose
is fired before this event. |
remove()
|
This event is fired when the marker is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
dragstart(latlng:GLatLng)
|
If the marker is enabled for dragging, this event is fired
when the marker dragging begins, passing in the current
coordinate of the marker within its latlng argument. |
drag(latlng:GLatLng)
|
If the marker is enabled for dragging, this event is fired
when the marker is being dragged, passing in the current
coordinate of the marker within its latlng argument. |
dragend(latlng:GLatLng)
|
If the marker is enabled for dragging, this event is fired
when the marker ceases to be dragged, passing in the current
coordinate of the marker within its latlng argument. |
visibilitychanged(isVisible:Boolean)
|
This event is fired when the visibility of the marker is changed
(i.e. the visibility is flipped from visible to hidden or vice-versa).
isVisible refers to the state of the marker after the
visibility change has happened.
(Since 2.77) |
This class is used to manage visibility of hundreds of markers on a map, based on the map's current viewport and zoom level. This class is deprecated; developers are recommended to use the open sourced MarkerManager instead.
| Constructor | Description |
|---|---|
GMarkerManager(map:GMap,
opts?:GMarkerManagerOptions)
|
Creates a new marker manager that controlls visibility of
markers for the specified map.
(Since 2.67) |
| Method | Return Value | Description |
|---|---|---|
addMarkers(markers:GMarker[],
minZoom:Number,
maxZoom?:Number)
|
None |
Adds a batch of markers to this marker manager. The markers are not added
to the map, until the refresh() method is called. Once
placed on a map, the markers are shown if they fall within the map's
current viewport and the map's zoom level is greater than or equal
to the specified minZoom. If the maxZoom
was given, the markers are automatically removed if the map's zoom
is greater than the one specified.
(Since 2.67) |
addMarker(marker:GMarker,
minZoom:Number,
maxZoom?:Number)
|
None |
Adds a single marker to a collection of markers controlled by this
manager. If the marker's location falls within the map's current
viewport and the map's zoom level is within the specified zoom level
rage, the marker is immediately added to the map. Similar to the
addMarkers method, the minZoom and the
optional maxZoom parameters specify the range of zoom
levels at which the marker is shown.
(Since 2.67) |
refresh()
|
None |
Forces the manager to update markers shown on the map. This method must
be called if markers were added using the addMarkers
method.
(Since 2.67) |
getMarkerCount(zoom:Number)
|
Number |
Returns the total number of markers potentially visible at the given
zoom level. This may include markers at lower zoom levels.
(Since 2.67) |
| Event | Description |
|---|---|
changed(bounds:GBounds,
markerCount:Number)
|
This event is fired when markers managed by a manager have been added to or removed from the map. The event handler function should be prepared to accept two arguments. The first one is the rectangle defining the bounds of the visible grid. The second one carries the number of markers currently shown on the map. |
This class represents optional arguments to the
GMarkerManager constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
borderPadding
|
Number |
Specifies, in pixels, the extra padding outside the map's current
viewport monitored by a manager. Markers that fall within this
padding are added to the map, even if they are not fully
visible.
(Since 2.67) |
maxZoom
|
Number |
Sets the maximum zoom level monitored by a marker manager. If
not given, the manager assumes the maximum map zoom
level. This value is also used when markers are added to the
manager without the optional maxZoom parameter.
(Since 2.67) |
trackMarkers
|
Boolean |
Indicates whether or not a marker manager should track
markers' movements. If you wish to move managed markers using
the setPoint method, this option should be set to
true. The default value is false.
(Since 2.67) |
Instances of this class are used in the
opts? argument to the constructor of the
GMarker class. There is no constructor for this
class. Instead, this class is instantiated as a javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
icon
|
GIcon |
Chooses the Icon for this class. If not specified,
G_DEFAULT_ICON is used.(Since 2.50) |
dragCrossMove
|
Boolean |
When dragging markers normally, the marker floats up and
away from the cursor. Setting this value to true
keeps the marker underneath the cursor, and moves the cross
downwards instead. The default value for this option is
false.(Since 2.63) |
title
|
String |
This string will appear as tooltip on the marker, i.e. it
will work just as the title attribute on HTML
elements.(Since 2.50) |
clickable
|
Boolean |
Toggles whether or not the marker is clickable. Markers that
are not clickable or draggable are inert, consume less resources
and do not respond to any events. The default value for this
option is true, i.e. if the option is not
specified, the marker will be clickable.(Since 2.50) |
draggable
|
Boolean |
Toggles whether or not the marker will be draggable by
users. Markers set up to be dragged require more resources to
set up than markers that are clickable. Any marker that is
draggable is also clickable, bouncy and auto-pan enabled by default. The default
value for this option is false.(Since 2.61) |
bouncy
|
Boolean |
Toggles whether or not the marker should bounce up and down
after it finishes dragging. The default value for this option is
false.(Since 2.61) |
bounceGravity
|
Number |
When finishing dragging, this number is used to define the
acceleration rate of the marker during the bounce down to
earth. The default value for this option is 1.(Since 2.61) |
autoPan
|
Boolean |
Auto-pan the map as you drag the marker near the edge. If the marker
is draggable the default value for this option is true.(Since 2.87) |
zIndexProcess
|
Function |
This function is used for changing the z-Index order of the markers
when they are overlaid on the map and is also called when their infowindow is opened.
The default order is that the more southerly markers are placed higher
than more northerly markers. This function is passed in
the GMarker object and returns a number indicating the new z-index.(Since 2.98) |
hide
|
Boolean |
When true, indicates that the map should not initially display the GMarker.
To turn on the overlay, call GMarker.show().
By default, this value is set to false.
(Since 2.139) |
This implementation of the
GProjection interface for the mercator projection is
used by all predefined map types.
| Constructor | Description |
|---|---|
GMercatorProjection(zoomlevels:Number)
|
Creates a mercator projection for the given number of zoom levels. |
| Method | Return Value | Description |
|---|---|---|
fromLatLngToPixel(latlng:GLatLng,
zoom:Number)
|
GPoint |
See GProjection. |
fromPixelToLatLng(pixel:GPoint,
zoom:Number,
unbounded?:Boolean)
|
GLatLng |
See GProjection. |
tileCheckRange(tile:GPoint,
zoom:Number,
tilesize:Number)
|
Boolean |
See GProjection. |
getWrapWidth(zoom:Number)
|
None |
See GProjection. Mercator projection is
periodic in longitude direction, therefore this returns the
width of the map of the entire Earth in pixels at the given zoom
level.(Since 2.46) |
This version of GMercatorProjection is
used by G_AERIAL_MAP and G_AERIAL_HYBRID_MAP. A
GObliqueMercator is a GMercatorProjection which is
foreshortened in the y-axis by a factor of the square root of 2.
| Constructor | Description |
|---|---|
GObliqueMercator(zoomlevels:Number,
heading:Number)
|
Creates an oblique mercator projection for the given number of zoom
levels and heading. (Since 2.193) |
| Method | Return Value | Description |
|---|---|---|
fromLatLngToPixel(latlng:GLatLng,
zoom:Number)
|
GPoint |
Returns the oblique map coordinates in pixels for the point at the
given geographical coordinates and zoom level.
See GMercatorProjection.(Since 2.193) |
fromPixelToLatLng(pixel:GPoint,
zoom:Number,
unbounded?:Boolean)
|
GLatLng |
Returns the geographical coordinates for the point at the
given oblique map coordinates in pixels, and the given zoom level. Flag
unbounded causes the geographical longitude coordinate
not to wrap when beyond the -180 or 180 degrees meridian.
See GMercatorProjection.(Since 2.193) |
tileCheckRange(tile:GPoint,
zoom:Number,
tilesize:Number)
|
Boolean |
Returns a boolean indicating if the tile index is in a valid range for
the map type.
See GMercatorProjection.(Since 2.193) |
getWrapWidth(zoom:Number)
|
None |
Returns the periodicity in x-direction, i.e. the number of pixels
after which the map repeats itself because it wrapped once round the
earth. By default, returns Infinity, i.e. the map will not
repeat itself.
See GMercatorProjection.(Since 2.193) |
This interface is implemented by the
GMarker, GPolyline, GTileLayerOverlay
and GInfoWindow classes in the maps API library. You can
implement it if you want to display custom types of overlay objects
on the map. An instance of GOverlay can be put on the
map with the method GMap2.addOverlay(). The map will
then call the method GOverlay.initialize() on the
overlay instance to display itself on the map initially. Whenever
the map display changes, the map will call
GOverlay.redraw() so that the overlay can reposition
itself if necessary. The overlay instance can use the method
GMap2.getPane() to get hold of one or more DOM
container elements to attach itself to.
| Constructor | Description |
|---|---|
GOverlay()
|
This constructor creates dummy implementations for the methods. Still, when inheriting from this class, your derived class constructor should call this constructor for completeness. |
| Method | Return Value | Description |
|---|---|---|
GOverlay.getZIndex(latitude:Number)
|
Number |
Returns a CSS z-index value for a given
latitude. It computes a z index such that overlays further south
are on top of overlays further north, thus creating the 3D
appearance of marker overlays. |
| Method | Return Value | Description |
|---|---|---|
initialize(map:GMap2)
|
None |
Called by the map after the overlay is added to the map
using GMap2.addOverlay(). The overlay object can
draw itself into the different panes of the map that can be
obtained using GMap2.getPane(). |
remove()
|
None |
Called by the map after the overlay is removed from the map
using GMap2.removeOverlay() or
GMap2.clearOverlays(). The overlay must remove
itself from the map panes here. |
copy()
|
GOverlay |
Returns an uninitialized copy of itself that can be added to the map. |
redraw(force:Boolean)
|
None |
Called by the map when the map display has changed. The
argument force will be true if the
zoom level or the pixel offset of the map view has changed, so
that the pixel coordinates need to be recomputed. |
getKml(callback:Function)
|
None |
This method is used to obtain the KML representation of
the overlay asynchronously. The callback function is called with
a single string argument that is a partial KML string representing
the overlay, or null if no KML representation is available. The
KML string will not include the XML declaration and root
<kml> element.(Since 2.167) |
| Event | Description |
|---|
Instances of this class are used in the
enableEditing methods of GPolyline and
GPolygon. There is no constructor for this
class. Instead, this class is instantiated as a javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
maxVertices
|
Number |
This property specifies the maximum number of vertices
permitted for this polyline.
Once this number is reached, no more may be added. (Since 2.111) |
fromStart
|
Boolean |
This property specifies whether enableDrawing should add
points from the
start rather than from the end, which is the default. (Since 2.111) |
Instances of this class are used in the
setStrokeStyle method of GPolyline and
GPolygon and the setFillStyle method of
GPolygon. There is no constructor for this
class. Instead, this class is instantiated as a javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
color
|
String |
This property specifies a string that contains a hexadecimal
numeric HTML style, i.e. #RRGGBB.
(Since 2.111) |
weight
|
Number |
This property specifies the width of the line in pixels. (Since 2.111) |
opacity
|
Number |
This property specifies the opacity of the polyline as a
fractional value between 0 (transparent) and 1 (opaque). (Since 2.111) |
This is very similar to a GPolyline,
except that you can additionally specify a fill color and opacity.
| Constructor | Description |
|---|---|
GPolygon(latlngs:GLatLng[],
strokeColor?:String,
strokeWeight?:Number,
strokeOpacity?:Number,
fillColor?:Number,
fillOpacity?:Number,
opts?:GPolygonOptions)
|
Creates a polygon from an array of vertices. The
colors are given as a string that contains the color
in hexadecimal numeric HTML style, i.e. #RRGGBB. The
weight is the width of the line in pixels. The
opacities is given as a number between 0 and 1. The
line will be antialiased and semitransparent.(Since 2.69) |
| Method | Return Value | Description |
|---|---|---|
GPolygon.fromEncoded(polylines:encoded polylines[],
fill?:Boolean,
color?:String,
opacity?:Number,
outline?:Boolean)
|
GPolygon |
Creates a polygon (consisting of a number of polylines)
from encoded strings of aggregated coordinates and levels.
polylines contains an associative array of constituent polylines,
encoded in the same format as described in
the GPolyline.fromEncoded
documentation. fill specifies whether to fill in
the polygon with a certain color. opacity
and outline specifies whether to stroke the polygon
with the polyline's color, weight and opacity. In case multiple values
are specified in polylines, the first polyline's values are taken.
(Since 2.78) |
| Method | Return Value | Description |
|---|---|---|
deleteVertex(index:Number)
|
None |
Removes with the given index in the polygon and updates
the shape of the polygon accordingly. The
GPolygon must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
disableEditing()
|
None |
Reverses the effects of enableEditing, removing all
control points from the line and rendering it uneditable by the
user.
(Since 2.111) |
enableDrawing(opts?:GPolyEditingOptions)
|
None |
Allows a user to construct a GPolygon
object by clicking on additional points on the map.
The GPolygon must already be added
to the map via the GMap2.addOverlay(), even if the polygon
is initially unpopulated and contains no vertices.
Each click adds
an additional vertex to the polygon boundary, and drawing may
be terminated through either a double-click, or clicking on the
first point to complete the shape, at which point an
"endline" event will
be triggered if the polygon was successfully completed; otherwise, a
"cancelline" event will be triggered, but the polygon will not be
removed from the map.
(Since 2.111) |
enableEditing(opts?:GPolyEditingOptions)
|
None |
Allows modification of an existing GPolygon boundary.
When enabled, users may select and drag existing vertices.
The GPolygon must already be added
to the map via GMap2.addOverlay().
Unless a vertex limit less than current number of vertices is
specified by maxVertices within
GPolyEditingOptions, "ghost" points
will also be added at the midpoints of polygon sections,
allowing users to interpolate new vertices by clicking and dragging
these additional vertices. A "lineupdated" event will be triggered
whenever vertex is added or moved.
(Since 2.111) |
getVertexCount()
|
Number |
Returns the number of vertices in the polygon. (Since 2.69) |
getVertex(index:Number)
|
GLatLng |
Returns the vertex with the given index in the
polygon. (Since 2.69) |
getArea()
|
Number |
Returns the area (in square meters) of the polygon, assuming
a spherical Earth. (Since 2.85) |
getBounds()
|
GLatLngBounds |
Returns the bounds for this polygon. (Since 2.85) |
hide()
|
None |
Hides the polygon if it is both currently visible and
GPolygon.supportsHide returns true.
Note that this function triggers the event
GPolygon.visibilitychanged in case the polygon is
currently visible.(Since 2.87) |
insertVertex(index:Number,
latlng:GLatLng)
|
None |
Inserts a new point at the given index in the polygon.
The GPolygon must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
isHidden()
|
Boolean |
Returns true if the polygon is currently hidden.
Otherwise returns false. (Since 2.87) |
show()
|
None |
Shows the polygon if it is currently hidden. Note that this
function triggers the event GPolygon.visibilitychanged
in case the polygon is currently hidden.(Since 2.87) |
supportsHide()
|
Boolean |
Returns true if GPolygon.hide()
is supported in the current environment for GPolygon
objects. Otherwise returns false. (Since 2.87) |
setFillStyle(style:GPolyStyleOptions)
|
None |
Changes the fill style of the polygon. The
GPolygon must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
setStrokeStyle(style:GPolyStyleOptions)
|
None |
Changes the line style of the polygon. The
GPolygon must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
| Event | Description |
|---|---|
remove()
|
This event is fired when the polygon is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
visibilitychanged(isVisible:Boolean)
|
This event is fired when the visibility state of the polygon
toggles from visible to hidden or vice versa. The
isVisible argument reflects the state of the polygon
after completion of this visibility state.
(Since 2.87) |
click(latlng:GLatLng)
|
This event is fired when the polygon is clicked, passing in the
clicked coordinate of the polygon within its latlng argument.
Note that this event also subsequently triggers a "click" event on the map,
where the polygon is passed as the overlay argument
within that event.
(Since 2.88>) |
mouseover()
|
This event is fired when the mouse moves into the region of the
polygon.
(Since 2.111) |
mouseout()
|
This event is fired when the mouse moves out of the region of the
polygon.
(Since 2.111) |
lineupdated()
|
This event is fired when either the style or shape of the
polygon is updated.
(Since 2.111) |
endline()
|
This event is fired when polygon drawing (initiated by call to
GPolyline.enableDrawing) is completed by the user.
(Since 2.111) |
cancelline()
|
This event is fired when polygon drawing (initiated by call to
GPolyline.enableDrawing) is aborted by the user.
(Since 2.111) |
Instances of this class are used in
GPolygon's constructor. There is no constructor for this
class. Instead, this class is instantiated as a javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
clickable
|
Boolean |
Toggles whether or not the polygon is clickable. The default
value for this option is true, i.e. if the option is not specified,
the polygon will be clickable.
(Since 2.91) |
mouseOutTolerance
|
number |
This property contains the distance (in pixels) for a mouse cursor to move
outside the polygon before the mouseout event fires.
(Since 2.158) |
This is a map overlay that draws a polyline on the map, using the vector drawing facilities of the browser if they are available, or an image overlay from Google servers otherwise.
| Constructor | Description |
|---|---|
GPolyline(latlngs:GLatLng[],
color?:String,
weight?:Number,
opacity?:Number,
opts?:GPolylineOptions)
|
Creates a polyline from an array of vertices. The
color is given as a string that contains the color
in hexadecimal numeric HTML style, i.e. #RRGGBB. The
weight is the width of the line in pixels. The
opacity is given as a number between 0 and 1. The
line will be antialiased and semitransparent. |
| Method | Return Value | Description |
|---|---|---|
GPolyline.fromEncoded(color?:String,
weight?:Number,
opacity?:Number,
latlngs:String,
zoomFactor:Number,
levels:String,
numLevels:Number)
|
GPolyline |
Creates a polyline from encoded strings of aggregated coordinates
and levels. color is a string that contains a
hexadecimal numeric HTML style,
i.e. #RRGGBB. weight is the width of the line in
pixels. opacity is a number between 0 and 1.
latlngs is a string containing the encoded latitude
and longitude coordinates. levels is a string
containing the encoded polyline zoom level
groups. numLevels is the number of zoom levels
contained in the encoded levels string.
zoomFactor is the magnification between adjacent
sets of zoom levels in the encoded levels
string. Together, these two values determine the precision of
the levels within an encoded polyline. The line
will be antialiased and semitransparent.(Since 2.63) |
| Method | Return Value | Description |
|---|---|---|
deleteVertex(index:Number)
|
None |
Removes the vertex with the given index in the polyline and
updates the shape of the polyline accordingly. The
GPolyline must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
disableEditing()
|
None |
Reverses the effects of enableEditing, removing all
control points from the line and rendering it uneditable by the
user.
(Since 2.111) |
enableDrawing(opts?:GPolyEditingOptions)
|
None |
Allows a user to construct (or modify) a GPolyline
object by clicking on additional points on the map.
The GPolyline must already be added
to the map via GMap2.addOverlay(), even if the polyline
is initially unpopulated and contains no vertices.
Each click adds
an additional vertex to the polyline chain, and drawing may
be terminated through either a double-click or clicking again on the
last point added, at which point an "endline" event will
be triggered if the polyline was successfully completed; otherwise, a
"cancelline" event will be triggered, but the polyline will not be
removed from the map.
If modifying an existing GPolyline, vertices are
connected from either the starting or ending points of the
existing polyline, specified in the
optional GPolyEditingOptions.fromStart parameter.
(Since 2.111) |
enableEditing(opts?:GPolyEditingOptions)
|
None |
Allows modification of an existing GPolyline chain of
points. When enabled, users may select and drag existing vertices.
The GPolyline must already be added
to the map via GMap2.addOverlay().
Unless a vertex limit less than current number of vertices is
specified by maxVertices within
GPolyEditingOptions, "ghost" points
will also be added at the midpoints of polyline sections,
allowing users to interpolate new vertices by clicking and dragging
these additional vertices. A "lineupdated" event will be triggered
whenever vertex is added or moved.
(Since 2.111) |
getVertexCount()
|
Number |
Returns the number of vertices in the polyline. (Since 2.46) |
getVertex(index:Number)
|
GLatLng |
Returns the vertex with the given index in the
polyline. (Since 2.46) |
getLength()
|
Number |
Returns the length (in meters) of the polyline along the surface of
a spherical Earth. (Since 2.85) |
getBounds()
|
GLatLngBounds |
Returns the bounds for this polyline. (Since 2.85) |
hide()
|
None |
Hides the polyline if it is both currently visible and
GPolyline.supportsHide() returns true.
Note that this function triggers the event
GPolyline.visibilitychanged in case the polyline is
currently visible.(Since 2.87) |
insertVertex(index:Number,
latlng:GLatLng)
|
None |
Inserts a new point at the given index in the polyline and
updates its shape. The
GPolyline must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
isHidden()
|
Boolean |
Returns true if the polyline is currently hidden.
Otherwise returns false. (Since 2.87) |
show()
|
None |
Shows the polyline if it is currently hidden. Note that this
function triggers the event GPolyline.visibilitychanged
in case the polyline is currently hidden.(Since 2.87) |
supportsHide()
|
Boolean |
Returns true if GPolyline.hide() is
supported in the current environment for GPolyline
objects. Otherwise returns false. (Since 2.87) |
setStrokeStyle(style:GPolyStyleOptions)
|
None |
Changes the style of the polyline. The
GPolyline must already be added to the map via
GMap2.addOverlay().
(Since 2.111) |
| Event | Description |
|---|---|
remove()
|
This event is fired when the polyline is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
visibilitychanged(isVisible:Boolean)
|
This event is fired when the visibility state of the polyline
toggles from visible to hidden or vice versa. The
isVisible argument reflects the state of the
polyline after completion of this visibility state.
(Since 2.87) |
click(latlng:GLatLng)
|
This event is fired when the polyline is clicked, passing in
the clicked coordinate of the line within its latlng argument.
Note that this event also subsequently triggers a "click" event on the map,
where the polyline is passed as the overlay argument
within that event.
(Since 2.88) |
mouseover()
|
This event is fired when the mouse moves onto the polyline.
(Since 2.111) |
mouseout()
|
This event is fired when the mouse moves off of the polyline.
(Since 2.111) |
lineupdated()
|
This event is fired when either the style or shape of the
polyline is updated.
(Since 2.111) |
endline()
|
This event is fired when line drawing (initiated by call to
GPolyline.enableDrawing) is completed by the user.
(Since 2.111) |
cancelline()
|
This event is fired when line drawing (initiated by call to
GPolyline.enableDrawing) is aborted by the user.
(Since 2.111) |
Instances of this class are used in
GPolyline's constructor. There is no constructor for this
class. Instead, this class is instantiated as a javascript object
literal.
As the name of this class indicates, all properties are optional.
| Property | Type | Description |
|---|---|---|
clickable
|
Boolean |
Toggles whether or not the polyline is clickable. The default
value for this option is true, i.e. if the option is not specified,
the polyline will be clickable.
(Since 2.91) |
geodesic
|
Boolean |
Render each edge of the polyline as a geodesic (a segment of a "great circle").
A geodesic is the shortest path between two points along the surface of the Earth.
(Since 2.84) |
mouseOutTolerance
|
number |
This property contains the distance (in pixels) for a mouse cursor to move
orthogonal to the polyline before the mouseout event fires.
(Since 2.158) |
This is the interface for map projections. A map
projection instance is passed to the constructor of
GMapType. This interface is implemented by the
class GMercatorProjection, which is used by all
predefined map types. You can implement this interface if you want
to define map types with different map projections.
These methods are called by the map. You need to implement them.
| Method | Return Value | Description |
|---|---|---|
fromLatLngToPixel(latlng:GLatLng,
zoom:Number)
|
GPoint |
Returns the map coordinates in pixels for the point at the given geographical coordinates, and the given zoom level. |
fromPixelToLatLng(pixel:GPoint,
zoom:Number,
unbounded?:Boolean)
|
GLatLng |
Returns the geographical coordinates for the point at the
given map coordinates in pixels, and the given zoom level. Flag
unbounded causes the geographical longitude coordinate
not to wrap when beyond the -180 or 180 degrees meridian. |
tileCheckRange(tile:GPoint,
zoom:Number,
tilesize:Number)
|
Boolean |
Returns to the map if the tile index is in a valid range for
the map type. Otherwise the map will display an empty tile. It
also may modify the tile index to point to another
instance of the same tile in the case that the map contains more
than one copy of the earth, and hence the same tile at
different tile coordinates. |
getWrapWidth(zoom:Number)
|
Number |
Returns to the map the periodicity in x-direction, i.e. the
number of pixels after which the map repeats itself because it
wrapped once round the earth. By default, returns
Infinity, i.e. the map will not repeat itself. This
is used by the map to compute the placement of overlays on map
views that contain more than one copy of the earth (this usually
happens only at low zoom levels).(Since 2.46) |
This object displays a rectangular image overlay on the map whose position remains fixed as the viewport changes. Sample uses for ScreenOverlays are compasses, logos, and heads-up displays.
| Constructor | Description |
|---|---|
GScreenOverlay(imageUrl:String,
screenXY:GScreenPoint,
overlayXY:GScreenPoint,
size:GScreenSize)
|
Creates a screen overlay from an image URL, and displays it
on the screen as specified by the screenXY,
overlayXY, and size parameters. The
overlayXY parameter determines the point on (or
outside of) the overlay image that is mapped to the screenXY
coordinate. This can be used to effectively 'crop' the image.
The screenXY parameter determines the point
relative to the screen origin (lower left corner) that the
overlay image is mapped to.(Since 2.92) |
| Method | Return Value | Description |
|---|---|---|
hide()
|
None |
Hides the screen overlay if it is currently visible. Note
that this function triggers the event
GScreenOverlay.visibilitychanged in case the screen
overlay is currently visible.(Since 2.92) |
isHidden()
|
Boolean |
Returns true if the screen overlay is currently
hidden. Otherwise returns false. (Since 2.92) |
show()
|
None |
Shows the screen overlay if it is currently hidden. Note
that this function triggers the event
GScreenOverlay.visibilitychanged in case the screen
overlay is currently hidden.(Since 2.92) |
supportsHide()
|
Boolean |
Always returns true.(Since 2.92) |
| Event | Description |
|---|---|
visibilitychanged(isVisible:Boolean)
|
This event is fired when the visibility state of the screen
overlay toggles from visible to hidden or vice versa. The
isVisible argument reflects the state of the screen
overlay after completion of this visibility state.
(Since 2.92) |
A GScreenPoint identifies a point on the
viewport of the map by an X and Y coordinate, each of which can represent fractional or
absolute positioning depending on the value of the optional constructor parameters.
| Constructor | Description |
|---|---|
GScreenPoint(x:Number,
y:Number,
xunits?:String,
yunits?:String)
|
Creates a GScreenPoint object. The x and y
coordinates can either represent fractional or absolute positoning by passing in "fraction"
or "pixels" to the xunits and yunits parameters.
The default value for those parameters is "pixels."
(Since 2.92) |
| Property | Type | Description |
|---|---|---|
x
|
Number |
x coordinate, increases to the left. |
y
|
Number |
y coordinate, increases downwards. |
xunits
|
String |
Specifies the type of units to use for x coordinate. Set this to "fraction" to indicate fractional position relative to map size, or "pixels" for absolute positioning. Defaults to absolute positioning. |
yunits
|
String |
Specifies the type of units to use for y coordinate. Set this to "fraction" to indicate fractional positionrelative to map size, or "pixels" for absolute positioning. Defaults to absolute positioning. |
A GScreenSize indicates the size of a
rectangular area of the map, determined by the width and
height parameters. Each of those parameters can represent fractional or
pixel size depending on the value of the optional constructor parameters.
| Constructor | Description |
|---|---|
GScreenSize(width:Number,
height:Number,
xunits?:String,
yunits?:String)
|
Creates a GScreenSize object. The width and height
coordinates can either represent fractional or pixel size by passing in "fraction"
or "pixels" to the xunits and yunits parameters.
The default value for the xunits and yunits
arguments is "pixels."
(Since 2.92) |
| Property | Type | Description |
|---|---|---|
width
|
Number |
The width parameter of the screen real estate. Note that this value
represents either a fractional or absolute pixel value depending on the
value of the GScreen.yunits property. |
height
|
Number |
The height parameter of the screen real estate. Note that this value
represents either a fractional or absolute pixel value depending on the
value of the GScreen.yunits property. |
xunits
|
String |
Specifies the type of units to use for the GScreenSize.width property.
Set this to "fraction" to indicate fractional position relative to map size,
or "pixels" for pixel positioning. Defaults to pixel positioning. |
yunits
|
String |
Specifies the type of units to use for the GScreenSize.height property.
Set this to "fraction" to indicate fractional position relative to map size,
or "pixels" for pixel positioning. Defaults to pixel positioning. |
You implement this interface in order to provide
custom map tile layers, either through GMapType or
GTileLayerOverlay. Your implementation of this interface should
use an instance of GTileLayer as a prototype, because
this implements the copyright handling for you.
| Constructor | Description |
|---|---|
GTileLayer(copyrights:GCopyrightCollection,
minResolution:Number,
maxResolution:Number,
options?:GTileLayerOptions)
|
Constructor arguments can be omitted if instantiated as
a prototype. A Subclass constructor must invoke this constructor
using call(). The optional options
parameter specifies a set of GTileLayerOptions
which should be passed as an object literal. |
These methods are called by the map and the map type to which this tile layer is passed. You will need to implement the methods marked abstract when you implement a custom tile layer.
| Method | Return Value | Description |
|---|---|---|
minResolution()
|
Number |
Returns to the map type the lowest zoom level of this tile layer. |
maxResolution()
|
Number |
Returns to the map type the highest zoom level of this tile layer. |
getTileUrl(tile:GPoint,
zoom:Number)
|
String |
Abstract. Returns to the map the URL of the map
tile with the tile indices given by the x and
y properties of the GPoint, at the
given zoom level. |
isPng()
|
Boolean |
Abstract. Returns to the map whether the tiles are in PNG image format and hence can be transparent. Otherwise GIF is assumed. |
getOpacity()
|
Number |
Abstract. Returns to the map the opacity with which to display this tile layer. 1.0 is opaque, 0.0 is transparent. |
getCopyright(bounds:GLatLngBounds,
zoom:Number)
|
String |
Abstract. Returns to the map the copyright messages for this tile
layer that are pertinent for the given map region at the given zoom level.
This is used to generate the copyright message of the GMapType
to which this tile layer belongs.(Since 2.89) |
| Event | Description |
|---|---|
newcopyright(copyright:GCopyright)
|
This event is fired when a new copyright is added to the copyright collection of this tile layer. |
This class represents optional arguments to the
GTileLayer interface. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
opacity
|
Number |
Sets the tile opacity from 0.0 (invisible) to 1.0 (opaque). The default is 1.0. Note that Internet Explorer 6 does not support PNG images with both opacities and alpha-transparencies. If you set an opacity in this case, you will lose the image's alpha-transparency. |
isPng
|
Boolean |
Indicates whether or not tiles are in the PNG format. |
tileUrlTemplate
|
String |
Specifies a template for the tile URLs that will be expanded for each tile request to
refer to a unique tile based on an existing tile coordinate system. Placing a template in
the GTileLayer constructor allows you to dynamically retrieve
tiles using this coordinate system, similar to the way Google Maps retrieves tiles.
Templates should be of the form: http://host/tile?x={X}&y={Y}&z={Z}.png
where X and Y refer to latitudinal and longitudinal tile coordinates, and Z refers to the zoom level. E.g. http://host/tile?x=3&y=27&z=5.png. |
draggingCursor
|
String |
The cursor to display while dragging the map. (Since 2.59) |
A GTileLayerOverlay augments the map with a
GTileLayer. It implements the GOverlay interface
and thus is added to the map using the GMap2.addOverlay()
method. The GTileLayer is presented on top of the existing
map imagery - to replace the imagery instead, put the GTileLayer
inside a custom GMapType.
| Constructor | Description |
|---|---|
GTileLayerOverlay(tileLayer:GTileLayer,
opts?:GTileLayerOverlayOptions)
|
Creates a GOverlay that wraps the tileLayer.(Since 2.61) |
| Method | Return Value | Description |
|---|---|---|
hide()
|
None |
Hides this overlay so it is not visible, but maintains its position
in the stack of overlays. (Since 2.71) |
isHidden()
|
None |
Returns true if the tile layer overlay is hidden.
Otherwise returns false.(Since 2.87) |
show()
|
None |
Shows a previously hidden GTileLayerOverlay.(Since 2.71) |
refresh()
|
None |
Reloads all the visible tiles attached to this GTileLayerOverlay.(Since 2.132) |
supportsHide()
|
None |
Always returns true.(Since 2.87) |
getTileLayer()
|
None |
Returns the tile layer used by this overlay. (Since 2.83) |
This class represents optional arguments to the
GTileLayerOverlayOptions constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
zPriority
|
Number |
zPriority contains a value which determines the relative
z-order for this TileLayerOverlay. Higher priority tile layers
will be rendered on top of tile layers with a lower priority.(Since 2.110) |
A GAdsManager object
fetches AdSense for Maps ads and
displays them on the specified map. Ads show up depending on the
style chosen and can be clicked on to bring
up the ad in a manner consistent with the style. The GAdsManager
selects AdSense ads based on the current viewport and the surrounding textual
content on the page. Note that when adding a GAdsManager to a
map, you must also specifically enable it using the enable()
method.
| Constructor | Description |
|---|---|
GAdsManager(map:GMap2,
publisherId:String,
adsManagerOptions?:GAdsManagerOptions)
|
Creates a new GAdsManager object that requests AdSense
ads from Google's servers. The map parameter identifies the
map on which this GAdsManager should display
ads. The publisherId parameter specifies the developer's
AdSense account. The adsManagerOptions parameter is a
GAdsManagerOptions object literal.(Since 2.85) |
| Method | Return Value | Description |
|---|---|---|
enable()
|
None |
Enables fetching of ads. Ads are not fetched by default. (Since 2.85) |
disable()
|
None |
Disables fetching of ads. (Since 2.85) |
This class stores optional arguments to
the GAdsManager constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
style
|
GAdsManagerStyle |
The AdSense for Maps style to exhibit for the placement of maps. (Since 2.158) |
maxAdsOnMap
|
Number |
The maximum number of ads to show on the map at any time. The default
value is 10, though in practice fewer ads are retrieved. (Since 2.85) |
channel
|
Number |
The
AdSense channel number used for fetching ads. Channels are an optional
feature that AdSense publishers can use to track ad revenue from
multiple sources. (Since 2.85) |
minZoomLevel
|
Number |
The minimum zoom level at which to show ads. The default value is
6. (Since 2.85) |
position
|
GControlPosition |
The position on the map at which to display ads when
GAdsManagerOptions.style is set to
G_ADSMANAGER_STYLE_ADUNIT. By default, ads exhibiting this
style are displayed at the lower right corner of the map.(Since 2.158) |
These constants indicate the style of the ads displayed by
the GAdsManager. The style is selected in the
GAdsManagerOptions.style property.
| Constant | Description |
|---|---|
G_ADSMANAGER_STYLE_ADUNIT
|
Specifies GAdsManager should display content ads in
a frame on the map.(Since 2.163) |
G_ADSMANAGER_STYLE_ICON
|
Specifies GAdsManager should display ads as individual
icons on the map.(Since 2.163) |
This class is used to communicate directly with Google servers to
obtain geocodes for user specified addresses. In addition, a geocoder
maintains its own cache of addresses, which allows repeated queries
to be answered without a round trip to the server.
As a general best practice, it is not recommended to use
GClientGeocoder functions in a loop.
Developers that have multiple addresses to geocode should probably use our
HTTP Geocoder instead.
| Constructor | Description |
|---|---|
GClientGeocoder(cache?:GGeocodeCache)
|
Creates a new instance of a geocoder that talks directly to Google
servers. The optional cache parameter allows one to specify a
custom client-side cache of known addresses. If none is specified,
a GFactualGeocodeCache is used.
(Since 2.55) |
| Method | Return Value | Description |
|---|---|---|
getLatLng(address:String,
callback:function)
|
None |
Sends a request to Google servers to geocode the specified
address. If the address was successfully located, the
user-specified callback function is invoked with a GLatLng
point. Otherwise, the callback function is given a null point. In
case of ambiguous addresses, only the point for the best match
is passed to the callback function.
(Since 2.55) |
getLocations(address:String,
callback:function)
|
None |
This method performs a geocode, the conversion of a human-readable
address into a latitude/longitude pair. getLocations()
sends a request to the Google geocoding service, asking it to parse
the given address and handle the response in the given
callback.As this method requires a call to a Google server, you must also pass a callback method to handle the response. This
response will contain a Status code, and if
successful, one or more
Placemark objects. Note that starting with version 2.133, this method has been augmented to also allow passing of GLatLng objects for
reverse-geocoding, as documented in the subsequent reference entry.
(Since 2.55) |
getLocations(latlng:GLatLng,
callback:function)
|
None |
This method performs reverse-geocoding, the conversion of
a latitude/longitude pair into human-readable addresses.
getLocations() sends a request to the Google geocoding
service, asking it to return the address for the given
latlng and pass the response in the
given callback.As this method requires a call to a Google server, you must also pass a callback method to handle the response. This
response will contain a Status code, and if
successful, one or more
Placemark objects.Note that this method may instead pass an addressable String, as indicated above; in that case, the service
will do a standard geocode. If however, the first argument contains a
GLatLng, the service will do a reverse-geocode.(Since 2.133) |
getCache()
|
GGeocodeCache |
Returns currently used geocode cache, or null, if no client-side
caching is performed.
(Since 2.55) |
setCache(cache:GGeocodeCache)
|
None |
Sets a new client-side caching. If this method is invoked
with cache set to null, client-side caching
is disabled. Setting a new cache discards previously stored
addresses.
(Since 2.55) |
setViewport(bounds:GLatLngBounds)
|
None |
Sets the geocoder to magnify geocoding results within or near the given viewport. The viewport is expressed
as a GLatLngBounds rectangle. Note that setting a viewport does not restrict results to
that bounding box, though it will elevate them in priority.
(Since 2.82) |
getViewport()
|
GLatLngBounds |
Returns the viewport for magnifying geocoding results within that geocoder. The viewport is expressed
as a GLatLngBounds rectangle.
(Since 2.82) |
setBaseCountryCode(countryCode:String)
|
None |
Sets the geocoder to bias search results as if they were sent from the domain specified by the given
country code top-level domain (ccTLD). Geocoding
is only supported for those countries in which Google Maps itself supports
geocoding. Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions.
For example, Great Britain's ccTLD is "uk" ( Note that the default domain is the domain from which you initially load the Maps API. Country codes are case insensitive. (Since 2.82) |
getBaseCountryCode()
|
String |
Returns the current country code in use by the given geocoder. (If no country code is in effect, this method returns null.)
(Since 2.82) |
reset()
|
None |
Resets the geocoder. In particular this method calls the
GGeocodeCache.reset() method on the client-side cache, if one is
used by this geocoder.
(Since 2.55) |
This class is used to obtain driving directions results and display them on a map and/or a text panel.
| Constructor | Description |
|---|---|
GDirections(map?:GMap2,
panel?:Element)
|
Creates a new instance of a directions object to request and store
direction results. This directions object can then create directions
given a query using the GDirections.load() method.The constructor takes an optional map object (to display a polyline of the computed directions) and/or a panel DIV element (to display textual direction results. If passed a map argument, whenever a
new directions result is computed, the polyline and markers associated with the
result are automatically added as overlays on the map. Similarly,
when passed a panel argument, the textual directions
associated with the result are added to the indicated DIV, replacing any existing
content in the DIV.If either of these arguments is null, the associated elements are not retrieved unless explicitly requested in the GDirections.load()
method. (See below.)
(Since 2.81) |
| Method | Return Value | Description |
|---|---|---|
load(query:String,
queryOpts?:GDirectionsOptions)
|
None |
This method issues a new directions query. The query parameter is
a string containing any valid directions query, e.g.
"from: Seattle to: San Francisco" or
"from: Toronto to: Ottawa to: New York".
By default, if a map was specified during construction of the
GDirections object, the query will request a polyline result.
Similarly, if a text panel was specified, the query will request detailed
textual results. Otherwise, the result will contain only summary information about
routes found.In order to override this behavior (e.g. to request polyline information even when no map was attached to this object), callers can use the queryOpts optional parameter. See the documentation for
GDirectionsOptions for details.
When directions results are received, this object clears old results,
replacing them with new ones and updating the map and/or panel with new
results. Directions results consist of multiple routes (objects of type
If a previous (Since 2.81) |
loadFromWaypoints(waypoints:Array,
queryOpts?:GDirectionsOptions)
|
None |
Issues a new directions query using an array of waypoints as input
instead of a single query string. This array may contain a maximum
of 25 waypoint entries. Each entry in the array is a
string representing an input address or a lat,lng point. See
GDirections.load() for more details on the behavior
of this method.
(Since 2.81) |
clear()
|
None |
Clears any existing directions results, removes overlays from the
map and panel, and cancels any pending load() requests.
(Since 2.81) |
getStatus()
|
Object |
Returns the status of the directions request. The returned object
has the following form: { code: 200 request: "directions" } The status code can take any of the values defined in GGeoStatusCode.
(Since 2.81) |
getBounds()
|
GLatLngBounds |
This method is used to get the bounding box for the result of this
directions query. Returns a GLatLngBounds object or null if no
successful result is available.
(Since 2.81) |
getNumRoutes()
|
Number |
Returns the number of routes available in the result. For a
successful query, this should be the total number of input
waypoints minus 1. When no results are available (either because
no query was issued or because the previous query was unsuccessful),
this method returns 0.
(Since 2.81) |
getRoute(i:Number)
|
GRoute |
Return the GRoute object for the ith route in the response.
(Since 2.81) |
getNumGeocodes()
|
Number |
Returns the number of geocoded entries available in the result. For a
successful query, this should be equal to the total number of input
waypoints. When no results are available (either because
no query was issued or because the previous query was unsuccessful),
this method returns 0.
(Since 2.81) |
getGeocode(i:Number)
|
Object |
Return the geocoded result for the ith waypoint. The structure of this
object is identical to that of a single placemark in a response from
the GClientGeocoder object.
(Since 2.81) |
getCopyrightsHtml()
|
String |
Returns an HTML string containing the copyright information for this
result.
(Since 2.81) |
getSummaryHtml()
|
String |
Returns an HTML snippet containing a summary of the distance and
time for this entire directions request. Note that this summary is
the only information returned to a GDirections object
constructed without an associated map or DIV element.
(Since 2.81) |
getDistance()
|
Object |
Returns an object literal representing the total distance of the
directions request (across all routes). The object contains two
fields: a number called "meters" indicating the numeric value of the
distance (in meters), and a string called "html" containing a
localized string representation of the distance in the
units that are predominant in the starting country of this
set of directions.
(Since 2.81) |
getDuration()
|
Object |
Returns an object literal representing the total time of the
directions request (across all routes). The object contains two
fields: a number called "seconds" indicating the numeric value of
the time (in seconds), and a string called "html" containing a
localized string representation of the time.
(Since 2.81) |
getPolyline()
|
GPolyline |
Returns the GPolyline object associated with the entire directions
response. Note that there is a single polyline that represents all
the routes in the response. This object will be defined only after
the directions results have been loaded (i.e. the "load" event has
been triggered).
(Since 2.81) |
getMarker(i:Number)
|
GMarker |
Return the marker associated with the ith geocode. This method will
return a non-null value only after the directions results have been
loaded (i.e. the "load" event has been triggered).
(Since 2.81) |
| Event | Description |
|---|---|
load()
|
This event is triggered when the results of a directions query issued
via GDirections.load() are available. Note that the
load() method initiates a new query, which in turn
triggers a "load" event once the query has finished loading. The "load"
event is triggered before any overlay elements are added to the map/panel.
(Since 2.81) |
addoverlay()
|
This event is triggered after the polyline and/or textual directions
components are added to the map and/or DIV elements. Note that the
"addoverlay" event is not triggered if neither of these elements are
attached to a GDirections object. This event is fired after
the polyline and/or textual directions components are added to hte map
and/or DIV elements.
(Since 2.81) |
error()
|
This event is triggered if a directions request results in an error.
Callers can use GDirections.getStatus() to get more
information about the error. When an "error" event occurs, no "load"
or "addoverlay" events will be triggered.
(Since 2.81) |
This class represents optional arguments to the
GDirections.load() and
GDirections.loadFromWaypoints() methods. It has no
constructor, but is instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
locale
|
String |
The locale to use for the directions result. For example, "en_US", "fr", "fr_CA", etc. |
travelMode
|
GTravelModes |
The mode of travel, such as driving (default) or walking. Note that
if you specify walking directions, you will need to specify a
<div> panel to hold a warning notice to users.(Since 2.129) |
avoidHighways
|
Boolean |
If true directions will attempt to exclude highways
when computing directions. Note that directions may still include
highways if there are no viable alternatives.(Since 2.124) |
getPolyline
|
Boolean |
By default, the GDirections.load*() methods
fetch polyline data only if a map is attached to the
GDirections object. This field can be used to override
this behavior and retrieve polyline data even when a map is not attached
to the Directions object. |
getSteps
|
Boolean |
By default, the GDirections.load*() methods
fetch steps data only if a panel is attached to the
GDirections object. This field can be used to override
this behavior and retrieve steps data even when a panel is not attached
to the Directions object. |
preserveViewport
|
Boolean |
By default, when a Directions object has a map, the map is
centered and zoomed to the bounding box of the the directions result.
When this option is set to true, the viewport is left alone for this
request (unless it was never set in the first place). |
This function provides a convenient way to
asynchronously retrieve a resource identified by a URL. Notice that,
since the XmlHttpRequest object is used to execute the request, it
is subject to the same-origin restriction of cross-site scripting,
i.e. the URL must refer to the same server as the URL of the current
document that executes this code. Therefore, it is usually redundant
to use an absolute URL for the url argument, and it is
better to use an absolute or relative path only.
It is the caller's responsibility to handle any exceptions that may be
thrown, such as security errors.
| Method | Return Value | Description |
|---|---|---|
GDownloadUrl(url:String,
onload:Function,
postBody?:String,
postContentType?:String)
|
None |
Retrieves the resource from the given URL and calls the
onload function with the text of the document as
first argument, and the HTTP response status code as the
second. If the request times out, the onload function may be
called instead with null as the first argument and -1 as the
second. This function defaults to sending an HTTP GET request.
To send an HTTP POST request instead, pass data within the
optional postBody argument. If the data being sent
is not of type "application/x-www-form-urlencoded," pass the
content type as a string in the postContentType
argument. This method is subject to cross-site scripting
restrictions. Note that this method uses the underlying
XmlHttpRequest implementation of the browser. |
This class refines the basic GGeocodeCache class by
placing stricter conditions on cached replies. It only caches replies
which are very unlikely to change within a short period of time.
| Constructor | Description |
|---|---|
GFactualGeocodeCache()
|
Creates a new cache that stores only replies it considers factual.
(Since 2.55) |
| Method | Return Value | Description |
|---|---|---|
isCachable(reply:Object)
|
Boolean |
Overrides the default implementation of this method to perform
a more thorough check of the status code. Only a reply with
Status.code set to G_GEO_SUCCESS, or known
to be invalid, is considered cachable. Replies that timed out
or resulted in a generic server error are not cached.
(Since 2.55) |
There are no symbolic constants defined for this enumeration.
| Constant | Description |
|---|---|
0
|
Unknown location.
(Since 2.59) |
1
|
Country level accuracy.
(Since 2.59) |
2
|
Region (state, province, prefecture, etc.) level accuracy.
(Since 2.59) |
3
|
Sub-region (county, municipality, etc.) level accuracy.
(Since 2.59) |
4
|
Town (city, village) level accuracy.
(Since 2.59) |
5
|
Post code (zip code) level accuracy.
(Since 2.59) |
6
|
Street level accuracy.
(Since 2.59) |
7
|
Intersection level accuracy.
(Since 2.59) |
8
|
Address level accuracy.
(Since 2.59) |
9
|
Premise (building name, property name, shopping center, etc.) level accuracy.
(Since 2.105) |
Numeric equivalents for each symbolic constant are specified next to the equal sign.
| Constant | Description |
|---|---|
G_GEO_SUCCESS |
No errors occurred; the address was successfully parsed and its
geocode has been returned.
(Since 2.55) |
G_GEO_BAD_REQUEST |
A directions request could not be successfully parsed.
For example, the request may have been rejected if it
contained more than the maximum number of waypoints allowed.
(Since 2.81) |
G_GEO_SERVER_ERROR |
A geocoding, directions or maximum zoom level request could not be
successfully processed, yet the exact reason for the failure is not
known.
(Since 2.55) |
G_GEO_MISSING_QUERY |
The HTTP q parameter was either missing or had no value.
For geocoding requests, this means that an empty address was specified
as input. For directions requests, this means that no query was
specified in the input.
(Since 2.81) |
G_GEO_MISSING_ADDRESS |
Synonym for G_GEO_MISSING_QUERY.
(Since 2.55) |
G_GEO_UNKNOWN_ADDRESS |
No corresponding geographic location could be found for the
specified address. This may be due to the fact that the address
is relatively new, or it may be incorrect.
(Since 2.55) |
G_GEO_UNAVAILABLE_ADDRESS |
The geocode for the given address or the route for the given directions
query cannot be returned due to legal or contractual reasons.
(Since 2.55) |
G_GEO_UNKNOWN_DIRECTIONS |
The GDirections object could not compute directions between the points
mentioned in the query. This is usually because there is no route
available between the two points, or because we do not have data for
routing in that region.
(Since 2.81) |
G_GEO_BAD_KEY |
The given key is either invalid or does not match the domain
for which it was given.
(Since 2.55) |
G_GEO_TOO_MANY_QUERIES |
The given key has gone over the requests limit in the 24 hour period
or has submitted too many requests in too short a period of time.
If you're sending multiple requests in parallel or in a tight loop,
use a timer or pause in your code to make sure you don't send the
requests too quickly.
(Since 2.55) |
A GGeoXml object add geographic content to the map
from an XML file (such as a KML file) that is hosted on a publicly accessible
web server. It implements the GOverlay interface and thus is
added to the map using the GMap2.addOverlay() method.
| Constructor | Description |
|---|---|
GGeoXml(urlOfXml:String,
callback?:function)
|
Creates a GOverlay that represents that XML
file. An optional callback function is invoked when the
GGeoXml object finishes loading the XML file.
(Deprecated since 2.108) |
GGeoXml(urlOfXml:String)
|
Creates a GOverlay that represents that XML
file.
(Since 2.108) |
| Method | Return Value | Description |
|---|---|---|
getTileLayerOverlay()
|
GTileLayerOverlay |
GGeoXml objects may create a tile overlay for
optimization purposes in certain cases. This method returns this
tile layer overlay (if available). Note that the tile overlay
may be null if not needed, or if the
GGeoXml file has not yet finished loading.(Deprecated since 2.141) |
getDefaultCenter()
|
GLatLng |
Returns the center of the default viewport as a lat/lng. This
function should only be called after the file has been loaded.
(Since 2.84) |
getDefaultSpan()
|
GLatLng |
Returns the span of the default viewport as a lat/lng. This
function should only be called after the file has been loaded.
(Since 2.84) |
getDefaultBounds()
|
GLatLngBounds |
Returns the bounding box of the default viewport. This
function should only be called after the file has been loaded.
(Since 2.84) |
gotoDefaultViewport(map:GMap2)
|
None |
Sets the map's viewport to the default viewport of the
XML file.
(Since 2.84) |
hasLoaded()
|
Boolean |
Checks to see if the XML file has finished loading, in which
case it returns true. If the XML file has not
finished loading, this method returns false.
(Since 2.84) |
hide()
|
None |
Hides the child overlays created by the GGeoXml
object if the overlay is both currently visible and the
overlay's supportsHide() method returns true. Note
that this method will trigger the respective
visibilitychanged event for each child overlay that
fires that event (e.g. GMarker.visibilitychanged,
GGroundOverlay.visibilitychanged, etc.). If no
overlays are currently visible that return
supportsHide() as true, this method has no effect.
(Since 2.87) |
isHidden()
|
Boolean |
Returns true if the GGeoXml object
is currently hidden, as changed by the
GGeoXml.hide() method. Otherwise returns
false. (Since 2.87) |
loadedCorrectly()
|
Boolean |
Checks to see if the XML file has loaded correctly, in which case
it returns true. If the XML file has not loaded
correctly, this method returns false. If the XML file
has not finished loading, this method's return value is undefined.
(Deprecated since 2.146) |
show()
|
None |
Shows the child overlays created by the GGeoXml
object, if they are currently hidden. Note that this method will
trigger the respective visibilitychanged event for
each child overlay that fires that event
(e.g. GMarker.visibilitychanged,
GGroundOverlay.visibilitychanged).
(Since 2.87) |
supportsHide()
|
Boolean |
Always returns true.(Since 2.87) |
| Event | Description |
|---|---|
load()
|
This event is fired when either the GGeoXml's XML file has
completely loaded and all associated overlays have been displayed on the map, or
if the XML file did not load correctly.(Since 2.108) |
This class maintains a map from addresses to known locations. While this class is fully functional, it is intended as a base class from which more sophisticated caches are derived.
| Constructor | Description |
|---|---|
GGeocodeCache()
|
Creates a new cache for storing a map from addresses to locations.
The constructor immediately calls the GGeocodeCache.reset
method.
(Since 2.55) |
| Method | Return Value | Description |
|---|---|---|
get(address:String)
|
Object |
Returns the reply which was stored under the given
address. If no reply was ever stored for the given
address, this method returns null.
(Since 2.55) |
isCachable(reply:Object)
|
Boolean |
Returns whether or not the given reply should be cached. By
default very rudimentary checks are performed on the
reply object. In particular, this class makes
sure that the object is not null and that it has
the name field . This method may be overridden by
extending classes to provide more precise conditions on the
reply object.
(Since 2.55) |
put(address:String,
reply:Object)
|
None |
Stores the given reply under the
given address. This method calls the
GGeocodeCache.isCachable method to verify that
the reply may be cached. If it gets a go-ahead, it
caches the reply under the address normalized with
the help of the GGeocodeCache.toCanoninical method.
(Since 2.55) |
reset()
|
None |
Purges all replies from the cache. After this method returns,
the cache is empty.
(Since 2.55) |
toCanonical(address:String)
|
String |
Returns what is considered a canonical version of the address.
It converts the address parameter to lower case,
replaces commas with spaces and replaces multiple spaces with
one space.
(Since 2.55) |
The GGoogleBar provides local search capabilities
within Maps API applications, allowing users to search locations for local
listings. The GGoogleBar has no constructor. It is
created by the map and accessed by the GMap2.enableGoogleBar()
method. Note: The GoogleBar is currently not compatible with the Google Earth
plugin, used by map type GMapType.G_SATELLITE_3D_MAP, and will be
disabled while the Earth plugin is shown.
This class represents options passed within the
adsOptions parameter to the GGoogleBarOptions
object. It has no constructor, but is instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
client
|
String |
This property specifies the Client ID of your Google AdSense for Search account.
Specifying this parameter allows you to gain revenue from the ads displayed in GoogleBar
search results. (Since 2.149) |
channel
|
String |
This property specifies the channel number of your Google AdSense for
Search account, if you've previously set up such a channel. AdSense channels
allow you to track advertising campaigns and determine which sources provide
revenue. Note that channels are tied to client IDs, so you must also pass
a client parameter if you wish to specify a channel.(Since 2.149) |
adsafe
|
String |
This property specifies the ad "safety" level to use for advertising
results on your GGoogleBar. Ad Safety levels indicate
the level of adult content filtering applied to search results. Four values
are available. 'high' (default) indicates that no adult ads are served.
'medium' indicates that adult-themed ads may be served when the user
specifically requests them (for example, ads for alcohol), but ads
for pornographic content will not be served. 'low' indicates adult-themed
and pornographic ads may be served when the user specifically requests
them. 'off' indicates any ads may be served. Any other values are ignored.(Since 2.149) |
language
|
String |
This property specifies the language in which to serve advertising
results. Languages are specified in BCP 47 language codes (for example 'en'
for English or 'pt-BR' for Brazilian Portugese). (Since 2.149) |
These constants are passed in GGoogleBarOptions.linkTarget, and define
the default target for links in result info windows.
| Constant | Description |
|---|---|
G_GOOGLEBAR_LINK_TARGET_BLANK
|
Corresponds to target = '_blank'. |
G_GOOGLEBAR_LINK_TARGET_PARENT
|
Corresponds to target = '_parent'. |
G_GOOGLEBAR_LINK_TARGET_SELF
|
Corresponds to target = '_self'. |
G_GOOGLEBAR_LINK_TARGET_TOP
|
Corresponds to target = '_top'. |
These constants restrict the type of results returned by a
local search with the GGoogleBar. This search behavior is set
within the GGoogleBarOptions.listingTypes property.
| Constant | Description |
|---|---|
G_GOOGLEBAR_TYPE_BLENDED_RESULTS
|
This constant indicates that searches from the map's
GGoogleBar should return all types of results
(KML, businesses, geocodes, etc).(Since 2.113) |
G_GOOGLEBAR_TYPE_KMLONLY_RESULTS
|
This constant indicates that searches from the map's
GGoogleBar should return only results from
indexed KML/KMZ/GeoRSS files.(Since 2.113) |
G_GOOGLEBAR_TYPE_LOCALONLY_RESULTS
|
This constant indicates that searches from the map's
GGoogleBar should return only business and
geocode results.(Since 2.113) |
This class represents options passed within the
googleBarOptions parameter to the GMapOptions
object. It has no constructor, but is instantiated as an object literal. Note that
the GGoogleBar object, like the GInfoWindow is not
constructed, but is automatically attached to the map object, and enabled through
properties described here.
| Property | Type | Description |
|---|---|---|
showOnLoad
|
Boolean |
This property, when set to true, displays the
GoogleBar text search box (provided the control is enabled and the
map is loaded). By default, the text search box within the control is
hidden and only expanded upon clicking the control's magnifying
glass. Note: when setting the style property to "new",
the GoogleBar text search box is always shown and this property is
ignored.(Since 2.95) |
style
|
String |
This property indicates the style in use by the GGoogleBar.
Setting style to "new" enables the GoogleBar's revamped
look and feel. (This style will become the default in the near future.)(Since 2.149) |
adsOptions
|
GGoogleBarAdsOptions |
This property indicates the parameters to use for the display of
advertising when using the GGoogleBar. Advertising is
enabled in the GoogleBar by default. Configure these options to
add information on how this advertising should be displayed and
to what AdSense accounts it should be linked (to gain revenue).(Since 2.149) |
linkTarget
|
GGoogleBarLinkTarget |
This property lets you specify the target for links embedded within the search
results of the GoogleBar. The default value,
G_GOOGLEBAR_LINK_TARGET_BLANK, specifies that links will open
within a new window.(Since 2.95) |
listingTypes
|
GGoogleBarListingTypes |
This property specifies the type(s) of search result listings
returned and displayed by the GoogleBar. The default is
G_GOOGLEBAR_TYPE_BLENDED_RESULTS, which specifies that both
KML and local (business listings and prominent features) results may be
returned.(Since 2.113) |
resultList
|
GGoogleBarResultList or Element |
This property lets you specify the style of the search result list for the
GoogleBar, which may be one of the following:
G_GOOGLEBAR_RESULT_LIST_INLINE (default) places the result list in a table
above the search box, G_GOOGLEBAR_RESULT_LIST_SUPPRESS
replaces the list with a set of next/previous buttons, and passing a block-level DOM
Element places the list within a container of your choice (typically
a <div> element).(Since 2.95) |
suppressInitialResultSelection
|
Boolean |
This property suppresses displaying the first result within its own info window
upon completion of a search in the GoogleBar (which is
the default behavior).(Since 2.95) |
suppressZoomToBounds
|
Boolean |
This property suppresses automatic panning and zooming to
the set of results upon completion of a search in the
GoogleBar. (This property suppresses the default
behavior.)(Since 2.95) |
onIdleCallback
|
Function |
This property specifies a callback function to be invoked when the
GoogleBar finishes searching and the search results are dismissed.(Since 2.95) |
onSearchCompleteCallback
|
Function |
This property specifies a callback function to be invoked when the
GoogleBar finishes searching and the search completes.
It is passed the
GlocalSearch object associated
with the search control. This callback function is called before
results are placed on the map or into the results list.(Since 2.95) |
onGenerateMarkerHtmlCallback
|
Function |
This property lets you specify a callback function to be invoked when the
info window for a search result marker is opened. The function should be passed a
GMarker, generated HTML string, and GlocalSearchResult
(in that order) and must return the modified HTML string to be displayed
in the info window.(Since 2.95) |
onMarkersSetCallback
|
Function |
This property lets you specify a callback function to be invoked when the
GGoogleBar completes creation of its markers and places them on the map.
This function must be passed an array of objects of the form
{result: GlocalSearch, marker: GMarker}.(Since 2.95) |
These constants are passed in GGoogleBarOptions.resultList, and define how the result list is displayed.
| Constant | Description |
|---|---|
G_GOOGLEBAR_RESULT_LIST_INLINE
|
This corresponds to the default style, where the result list is displayed in tabular form on the map. |
G_GOOGLEBAR_RESULT_LIST_SUPPRESS
|
This corresponds to the default style, where the result list is hidden and replaced with next/previous buttons.. |
This class uniquely identifies a user contributed photo in Street View. It has no constructor, but is instantiated as an object literal. All properties are optional.
| Property | Type | Description |
|---|---|---|
repository
|
string |
The repository storing the photo. Currently, only the value
'panoramio' is supported.
(Since 2.182) |
id
|
string |
A string that uniquely identifies the photo given its repository.
For Panoramio, this is the string representation of the panoramio
'photo_id'. See the
panoramio API for information about how to obtain photo IDs
given a lat/long bounding box.
(Since 2.182) |
This class represents the structure of a camera point of view used by street view. It has no constructor, but is instantiated as an object literal. All properties are optional.
| Property | Type | Description |
|---|---|---|
yaw
|
Number |
The camera yaw in degrees relative to true north. True north is
0 degrees, east is 90 degrees, south is 180 degrees, west is 270 degrees.
(Since 2.104) |
pitch
|
Number |
The camera pitch in degrees, relative to the street view vehicle.
Ranges from 90 degrees (directly upwards) to -90 degrees
(directly downwards).
(Since 2.104) |
zoom
|
Number |
The zoom level. Fully zoomed-out is level 0, zooming in increases
the zoom level. (Since 2.104) |
Objects of this class are created by the GDirections object to store information about a single route in a directions result. This class does not have a public constructor. Clients should not directly create objects of this class.
| Method | Return Value | Description |
|---|---|---|
getNumSteps()
|
Number |
Returns the number of steps in this route.
(Since 2.81) |
getStep(i:Number)
|
GStep |
Return the GStep object for the ith step in this route.
(Since 2.81) |
getStartGeocode()
|
Object |
Return the geocode result for the starting point of this route. The
structure of this object is identical to that of a single placemark
in a response from the GClientGeocoder object.
(Since 2.83) |
getEndGeocode()
|
Object |
Return the geocode result for the ending point of this route. The
structure of this object is identical to that of a single placemark
in a response from the GClientGeocoder object.
(Since 2.83) |
getEndLatLng()
|
GLatLng |
Returns a GLatLng object for the last point along the polyline
for this route. Note that this point may be different from the lat,lng
in GRoute.getEndGeocode() because getEndLatLng() always
returns a point that is snapped to the road network. There is no
corresponding getStartLatLng() method because that is identical to
calling GRoute.getStep(0).getLatLng().
(Since 2.81) |
getSummaryHtml()
|
String |
Returns an HTML snippet containing a summary of the distance and
time for this route.
(Since 2.81) |
getDistance()
|
Object |
Returns an object literal representing the total distance of this
route. See GDirections.getDistance() for the structure of this object.
(Since 2.81) |
getDuration()
|
Object |
Returns an object literal representing the total time of this
route. See GDirections.getDuration() for the structure of this object.
(Since 2.81) |
Objects of this class are created by the GDirections object to store information about a single step within a route in a directions result. This class does not have a public constructor. Clients should not directly create objects of this class.
| Method | Return Value | Description |
|---|---|---|
getLatLng()
|
GLatLng |
Returns a GLatLng object for the first point along the polyline
for this step.
(Since 2.81) |
getPolylineIndex()
|
Number |
Returns the index of the first point along the polyline for this step.
(Since 2.81) |
getDescriptionHtml()
|
String |
Return an HTML string containing the description of this step.
(Since 2.81) |
getDistance()
|
Object |
Returns an object literal representing the total distance of this
step. See GDirections.getDistance() for the structure of this object.
(Since 2.81) |
getDuration()
|
Object |
Returns an object literal representing the total time of this
step. See GDirections.getDuration() for the structure of this object.
(Since 2.81) |
A GStreetviewClient object performs searches for Street View
data based on parameters that are passed to its methods.
| Constructor | Description |
|---|---|
GStreetviewClient()
|
Creates a new GStreetviewClient
(Since 2.104) |
| Method | Return Value | Description |
|---|---|---|
getNearestPanoramaLatLng(latlng:GLatLng,
callback:Function(GLatLng))
|
None |
Finds the GLatLng of the nearest panorama to a
given point and passes it to the provided callback. If there are
no nearby panoramas, or if a server error occurs, the provided
callback is passed null instead.
(Since 2.104) |
getNearestPanorama(latlng:GLatLng,
callback:Function(GStreetviewData))
|
None |
Retrieves the data for the nearest panorama to a given latlng and
passes it to the provided callback as a
GStreetviewData object.
(Since 2.104) |
getPanoramaById(panoId:string,
callback:Function(GStreetviewData))
|
None |
Retrieves the data for the given panorama id and passes it to
the provided callback as a
GStreetviewData object. Ids are unique
per panorama and stable for the lifetime of a session, but are
liable to change between sessions.
(Since 2.104) |
Numeric equivalents for each symbolic constant are specified next to the equal sign.
| Constant | Description |
|---|---|
SUCCESS |
Success (Since 2.104) |
SERVER_ERROR |
The server is not responding to queries. (Since 2.104) |
NO_NEARBY_PANO |
No panorama data was found. (Since 2.104) |
This class represents the data associated to a panorama. It has no constructor, but is instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
location
|
GStreetviewLocation |
The location data. (Since 2.104) |
copyright
|
String |
A localized copyright attribution. (Since 2.104) |
links
|
GStreetviewLink[] |
Links to neighbouring panoramas, if any. (Since 2.104) |
code
|
GStreetviewClient.ReturnValues |
Status code. See GStreetviewClient.ReturnValues.(Since 2.104) |
This class controls which major viewing modes that should be enabled. This class has no constructor but is instantiated as an object literal. All properties are optional.
| Property | Type | Description |
|---|---|---|
streetView
|
Boolean |
The streetView viewing mode shows panoramic
images taken from street level. This is the standard viewing
mode of GStreetviewPanorama.
(Since 2.182) |
userPhotos
|
Boolean |
The userPhotos viewing mode allows viewing of
user generated photos. When both this feature and
the streetView feature is enabled, photos will
automatically appear when available as thumbnails in the top
right corner of the Street View panorama. Photos may also be
displayed programmatically using
the GStreetviewPanorama.setUserPhoto() function.
(Since 2.182) |
This class represents a link from one
GStreetviewLocation to a neighbouring
GStreetviewLocation. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
yaw
|
Number |
The yaw from the current location to the neighbouring location. (Since 2.104) |
description
|
String |
A localized string describing the neighbouring location. (Since 2.104) |
panoId
|
String |
A unique identifier for the neighbouring panorama.
This is stable within a session but unstable across sessions. (Since 2.104) |
This class represents a street view location. It has no constructor, but is instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
latlng
|
GLatLng |
The latlng of the panorama. (Since 2.104) |
pov
|
GPov |
The initial point of view. (Since 2.104) |
description
|
String |
A localized string describing the location. (Since 2.104) |
panoId
|
String |
A unique identifier for the panorama.
This is stable within a session but unstable across sessions. (Since 2.104) |
A GStreetviewOverlay object is a tileset highlighting
locations where Street View data is available. This class implements
the GOverlay interface and can be added to the map
using map.addOverlay and removed using
map.removeOverlay.
| Constructor | Description |
|---|---|
GStreetviewOverlay()
|
Creates a new GStreetviewOverlay which implements the
GOverlay interface.(Since 2.104) |
| Event | Description |
|---|---|
changed(hasStreetviewData:Boolean)
|
This event is fired when the state of Street View data changes
within the current viewport. It is fired when moving the map
from an area with Street View data to one without, and
vice-versa. It is also fired when the addition of a
GStreetviewOverlay to the map results in Street
View data appearing within the viewport.
The hasStreetviewData parameter will be
true if the viewport contains Street View data and
false otherwise.
(Since 2.120) |
A GStreetviewPanorama object holds an instance of the
Flash® Street View Panorama viewer. Each object of this class
can hold a separate instance, showing a unique view. This object is
normally embedded within a container object such as a
DIV
and can be manipulated to change its view using the methods of this
class. Street View data is not available for all locations. Use the
GStreetviewClient object or the GStreetviewOverlay
object to determine if Street View data is available for your location.
| Constructor | Description |
|---|---|
GStreetviewPanorama(container:Node,
opts?:GStreetviewPanoramaOptions)
|
Creates a new GStreetviewPanorama object with a
corresponding flash viewer in the provided container. The viewer will
not be shown until a location has been specified, either in the optional
GStreetviewPanoramaOptions opts object or by
calling setLocationAndPOV.
(Since 2.104) |
| Method | Return Value | Description |
|---|---|---|
remove()
|
None |
Removes the instance of the flash viewer currently associated with
this object from the DOM. This function must be called before removing
the HTML container element otherwise some browsers will fail to garbage
collect the flash viewer.
(Since 2.104) |
setContainer(container:Node)
|
None |
Sets the container element for the flash viewer, moving the viewer
from its old location if it is currently open.
(Since 2.104) |
checkResize()
|
None |
Notifies the flash viewer of a change of the size of its
container. Call this method after the size of the container DOM
object has changed, so that the viewer can adjust itself to fit the
new size.
(Since 2.104) |
hide()
|
None |
Hides the flash viewer. To remove the viewer, call .remove() instead.
(Since 2.104) |
show()
|
None |
Shows the flash viewer.
(Since 2.104) |
isHidden()
|
boolean |
Returns true if the flash viewer associated with this
object is hidden, otherwise false.(Since 2.104) |
getLatLng()
|
GLatLng |
Returns the latitude and longitude of the panorama object.
(Since 2.189) |
getPanoId()
|
string |
Returns the ID of the panorama object.
(Since 2.189) |
getPOV()
|
GPov |
Returns the current point of view (POV) displayed in the flash
viewer.
(Since 2.104) |
setPOV(pov:GPov)
|
None |
Changes the current point of view (POV) displayed in the flash viewer
without changing the location.
(Since 2.104) |
panTo(pov:GPov,
opt_longRoute:Boolean)
|
None |
Changes the current point of view (POV) displayed in the flash viewer
without changing the location. Performs a smooth animation from the
current POV to the new POV. If opt_longRoute is set then the animation
will follow a long route around the sphere, otherwise the shortest
route.
(Since 2.104) |
setLocationAndPOV(latlng:GLatLng,
opt_pov:GPov)
|
None |
Sets the location and POV of the flash viewer. After calling
this function, the viewer will display the nearest location to
the latlng provided if one is available. If no data is available
for this location, then the flash player will remain unchanged
and emit an error code. See GStreetviewClient.ReturnValues
for the possible response codes.
(Since 2.104) |
setUserPhoto(photoSpec:GPhotoSpec)
|
None |
Shows a user-contributed photo in the flash viewer. After
calling this function, the viewer will display the photo
uniquely identified by photoSpec. If the photo
cannot be displayed, then the flash player will remain unchanged
and emit the error
code GStreetviewPanorama.ErrorValues.NO_PHOTO.
(Since 2.182) |
followLink(yaw:Number)
|
None |
Follows a link from the current panorama to a neighbouring
panorama. yaw specifies the direction of the neighbouring
panorama; if there are multiple neighbouring panoramas then the
nearest match will be taken.(Since 2.104) |
| Event | Description |
|---|---|
yawchanged(yaw:Number)
|
This event is fired when the yaw displayed in the flash viewer is
changed.
(Since 2.104) |
pitchchanged(pitch:Number)
|
This event is fired when the pitch displayed in the flash viewer is
changed.
(Since 2.104) |
zoomchanged(zoom:Number)
|
This event is fired when the zoom level of the flash viewer is
changed.
(Since 2.104) |
error(errorCode:GStreetviewPanorama.ErrorValues)
|
This event is fired when an error occurs. See
GStreetviewPanorama.ErrorValues for a list of error
types.(Since 2.104) |
initialized(location:GStreetviewLocation)
|
This event is fired when the panorama is initialized after
moving to a new location. The location is a GStreetviewLocation
object. Note: the initialized event is not sent when the
panorama is first rendered; this is a known issue and we plan to fix
this in a future release.
(Deprecated since 2.170) |
initialized(location:GStreetviewLocation)
|
This event is fired each time a panorama is initialized. The location
is a GStreetviewLocation object. Note that this event is
fired as soon as rendering starts, but that all image data may not
be loaded at this time.
(Since 2.170) |
Numeric equivalents for each symbolic constant are specified next to the equal sign.
| Constant | Description |
|---|---|
NO_NEARBY_PANO |
No panorama data was found. (Since 2.104) |
NO_PHOTO |
No user photo was found. (Since 2.182) |
FLASH_UNAVAILABLE |
The flash viewer was not available, typically because the user's
browser does not support flash. (Since 2.104) |
This class represents the options passed to the
GStreetviewPanorama constructor. This class has no constructor
but is instantiated as an object literal. All properties are
optional.
| Property | Type | Description |
|---|---|---|
latlng
|
GLatLng |
The latlng at which to open the flash viewer.
(Since 2.104) |
pov
|
GPov |
The camera orientation with which to open the flash viewer.
(Since 2.104) |
enableFullScreen
|
Boolean |
By default, the panorama viewer features a full-screen
control in the upper right corner. To exclude the full-screen
control, set this flag to false.
(Since 2.175) |
features
|
GStreetviewFeatures |
By default, the panorama viewer will enable all major
viewing modes. This flag may be used to selectively enable or
disable certain modes.
(Since 2.182) |
userPhotosOptions
|
GStreetviewUserPhotosOptions |
This optional property is ignored unless the userPhotos
feature is enabled using the GStreetviewFeatures class.
(Since 2.182) |
This class represents the options available in
the userPhotos viewing mode. This class has no
constructor but is instantiated as an object literal. All
properties are optional.
| Property | Type | Description |
|---|---|---|
photoRepositories
|
Array |
An optional array of strings. Each string specifies a photo
repository to enable. If absent, all photo repositories will be
enabled. Valid array values are: 'panoramio' and 'picasa'.
(Since 2.182) |
A GTrafficOverlay object adds an
overlay to the map that displays road traffic information. It
implements the GOverlay interface and thus is added to
the map using the GMap2.addOverlay() method and removed
using the GMap2.removeOverlay() method. The
GTrafficOverlay will only display traffic information for
supported cities.
| Constructor | Description |
|---|---|
GTrafficOverlay(opts?:GTrafficOverlayOptions)
|
Creates a new GTrafficOverlay object that shows road traffic information.(Since 2.81) |
| Method | Return Value | Description |
|---|---|---|
hide()
|
None |
Hides the traffic overlay. (Since 2.81) |
show()
|
None |
Shows the traffic overlay. (Since 2.81) |
| Event | Description |
|---|---|
changed(hasTrafficInView:Boolean)
|
This event is fired when the state of traffic data changes within the current
viewport. This event may be fired either when moving the map between areas with
and without traffic data or when the addition of a GTrafficOverlay
to the map results in traffic data appearing within the current viewport.
The hasTrafficInView parameter will be true if the
viewport contains traffic data and false otherwise.
The event works regardless of whether the layer is hidden or shown.
(Since 2.85) |
This class represents optional arguments to the
GTrafficOverlay constructor. It has no constructor, but is
instantiated as an object literal.
| Property | Type | Description |
|---|---|---|
incidents
|
Boolean |
When true, indicates that the
GTrafficOverlay should display traffic incidents
on the map, where applicable. By default, this value
is set to false.(Since 2.121) |
hide
|
Boolean |
When true, indicates that the map should not
initially display the GTrafficOverlay. To turn on
the overlay, call GTrafficOverlay.show().
By default, this value is set to false.
(Since 2.121) |
| Constant | Description |
|---|---|
G_TRAVEL_MODE_WALKING
|
Walking (Since 2.129) |
G_TRAVEL_MODE_DRIVING
|
Driving (Since 2.129) |
This namespace provides static methods to handle XML documents and document fragments.
| Method | Return Value | Description |
|---|---|---|
GXml.parse(xmltext:String)
|
Node |
Parses the given string as XML text and returns a DOM
representation. If the browser doesn't support XML parsing
natively, this returns the DOM node of an empty DIV
element. |
GXml.value(xmlnode:Node)
|
String |
Returns the text value (i.e., only the plain text content) of the XML document fragment given in DOM representation. |
This namespace provides a factory method to create
XmlHttpRequest instances in a browser independent
way.
| Method | Return Value | Description |
|---|---|---|
GXmlHttp.create()
|
GXmlHttp |
Factory to create a new instance of
XmlHttpRequest. |
This class provides methods to apply XSLT to XML in a browser-independent way.
| Method | Return Value | Description |
|---|---|---|
GXslt.create(xsltnode:Node)
|
GXslt |
Creates a GXslt instance from the XSLT
stylesheet given as DOM representation. |
GXslt.transformToHtml(xmlnode:Node,
htmlnode:Node)
|
Boolean |
Uses the XSLT stylesheet given in the constructor of this
GXslt instance to transform the XML document given
as DOM representation in xmlnode. Appends the
resulting HTML document fragment to the given
htmlnode. This only works if the browser natively
supports XSL transformations, in which case it will return
true. Otherwise, this function will do nothing and
return false. |