Google Maps API Reference
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.
If you only want to use the map to display your content, then
you need to know these classes, types, and functions:
If you want to extend the functionality of the maps API by
implementing your own controls, overlays, or map types, then you
also need to know these classes and types:
class GMap2
Instantiate class GMap2 in order to
create a map. This is the central class in the API. Everything
else is auxiliary.
Constructor
| Constructor |
Description |
| GMap2(container, opts?) |
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. |
Methods
Configuration
| Methods |
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 (disabled 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. (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) |
Controls
| Methods |
Return Value |
Description |
| addControl(control, position?) |
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) |
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(). |
Map Types
| Methods |
Return Value |
Description |
| getMapTypes() |
Array of GMapType |
Returns the array of map types registered with this map. |
| getCurrentMapType() |
GMapType |
Returns the currently selected map type. |
| setMapType(type) |
none |
Selects the given new map type. The type must be known to
the map. See the constructor, and the method
addMapType(). |
| addMapType(type) |
none |
Adds a new map type to the map. See section GMapType for how to define
custom map types. |
| removeMapType(type) |
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. |
Map State
| Methods |
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) |
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) |
Modify the Map State
| Methods |
Return Value |
Description |
| setCenter(center, zoom?,
type?) |
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 other operations on the map after
construction. |
| panTo(center) |
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) |
none |
Starts a pan animation by the given distance in pixels. |
| panDirection(dx, dy) |
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) |
none |
Sets the zoom level to the given new value. |
| zoomIn() |
none |
Increments zoom level by one. |
| zoomOut() |
none |
Decrements zoom level by one. |
| 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. |
Overlays
| Methods |
Return Value |
Description |
| addOverlay(overlay) |
none |
Adds an overlay to the map and fires the
addoverlay event. |
| removeOverlay(overlay) |
none |
Removes the overlay from the map. If the overlay was on the
map, it fires the removeoverlay event. |
| clearOverlays() |
none |
Removes all overlay from the map, and fires the
clearoverlays event. |
| getPane(pane) |
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 |
Info Window
| Methods |
Return Value |
Description |
| openInfoWindow(latlng, node,
opts?) |
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, html,
opts?) |
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, tabs, opts?) |
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, tabs, opts?) |
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, opts?) |
none |
Opens an info window at the given point that contains a
closeup view on the map around this point. |
| updateInfoWindow(tabs,
onupdate?) |
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, onupdate?) |
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(). |
Coordinate Transformations
| Methods |
Return Value |
Description |
| fromContainerPixelToLatLng(pixel) |
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) |
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) |
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) |
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. |
Events
| Events |
Arguments |
Description |
| addmaptype |
type |
This event is fired when a map type is added to the map. |
| removemaptype |
type |
This event is fired when a map type is removed from the map. |
| click |
overlay, latlng
|
This event is fired when the map is clicked with the
mouse. If the click was on a clickable overlay (like a GMarker, GPolygon, GPolyline, or GInfoWindow),
then that overlay is passed to the event handler in the overlay argument, and a
click event is also fired on the overlay. Otherwise,
the geographical coordinates of the point that was clicked are
passed in the latlng argument. |
| dblclick |
overlay, latlng
|
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, src, overlay?
|
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 |
none |
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 |
none |
This event is fired, possibly repeatedly, while the map
view is changing. |
| moveend |
none |
This event is fired when the change of the map view ends. |
| zoomend |
oldLevel, newLevel
|
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 |
none |
This event is fired when another map type is selected. |
| infowindowopen |
none |
This event is fired when the info window opens. |
| infowindowbeforeclose |
none |
This event is fired before the info window closes. (Since 2.83) |
| infowindowclose |
none |
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 |
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 |
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 |
none |
This event is fired when all overlays are removed at once
by the method clearOverlays(). |
| mouseover |
latlng |
This event is fired when the user moves the mouse over the
map from outside the map. |
| mouseout |
latlng |
This event is fired when the user moves the mouse off the
map. |
| mousemove |
latlng |
This event is fired when the user moves the mouse inside the
map. |
| dragstart |
none |
This event is fired when the user starts dragging the map. |
| drag |
none |
This event is repeatedly fired while the user drags the
map. |
| dragend |
none |
This event is fired when the user stops dragging the map. |
| load |
none |
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) |
class GMapOptions
This class represents optional arguments to the
GMap2 constructor. It has no constructor, but is
instantiated as an object literal.
Properties
| Properties |
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 |
Array of 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 GGoogleBar search control.
These options are passed to the GMapOptions object literal when the map is constructed,
and are used to construct the local GGoogleBar control when
GMap2.enableGoogleBar() is called. (Since 2.95) |
class GGoogleBarOptions
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.
Properties
| Properties |
Type |
Description |
| showOnLoad |
boolean |
When set to true, this property displays the search box within the
GoogleBar (provided the control is enabled and the map is loaded).
By default, the search box within the control is hidden and is only
expanded upon clicking the control's magnifying glass. (Since 2.95) |
| 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) |
| 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_GOOGLE_BAR_RESULT_LIST_INLINE (default) places the result list in a table
above the search box, G_GOOGLE_BAR_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) |
enum GGoogleBarLinkTarget
These constants are passed in GGoogleBarOptions.linkTarget, and define
the default target for links in result info windows.
Constants
| Constants |
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'. |
enum GGoogleBarResultList
These constants are passed in GGoogleBarOptions.resultList, and define how the result list is displayed.
Constants
| Constants |
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.. |
enum GMapPane
These constants define the layering system that is
used by overlay to display themselves on the map. There are
different layers for icons, shadows, the info window, the shadow on
the info window, and transparent mouse event catching objects.
You need to use this type if you subclass from
GOverlay.
Constants
| Constants |
Description |
| G_MAP_MAP_PANE |
This pane is still below the shadows of the markers,
directly on top of the map. It contains for instance the
polylines. |
| G_MAP_MARKER_SHADOW_PANE |
This pane contains the shadows of the markers. It is below
the markers. |
| G_MAP_MARKER_PANE |
This pane contains the markers. |
| G_MAP_FLOAT_SHADOW_PANE |
This pane contains the shadow of the info window. 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 everything
else on the map. |
class GKeyboardHandler
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
| Constructor |
Description |
| GKeyboardHandler(map) |
Installs keyboard event handler for the map passed as argument. |
interface GOverlay
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
| 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. |
Static Methods
| Static Methods |
Return Value |
Description |
| getZIndex(latitude) |
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. |
Abstract Methods
| Abstract Methods |
Return Value |
Description |
| initialize(map) |
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) |
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. |
class GInfoWindow
GInfoWindow has no constructor. It is
created by the map and accessed by its method
GMap2.getInfoWindow().
Methods
| Methods |
Return Value |
Description |
| selectTab(index) |
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, tabs, size, offset?, selectedTab?) |
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() |
Array of GInfoWindowTabs |
Returns the array of tabs in this info window. (Since 2.59) |
| getContentContainers() |
Array of 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) |
Events
| Events |
Arguments |
Description |
| closeclick |
none |
This event is fired when the info window close button is
clicked. An event handler for this event can implement to close
the info window, by calling the
GMap2.closeInfoWindow() method. |
| maximizeclick |
none |
Signals that the info window is about to be maximized. (Since 2.93) |
| maximizeend |
none |
Signals that the info window has completed maximization. (Since 2.93) |
| restoreclick |
none |
Signals that the info window is about to be restored to the
non-maximized state. (Since 2.93) |
| restoreend |
none |
Signals that the info window has completed the restore operation
to the non-maximized state.
(Since 2.93) |
class GInfoWindowTab
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
| Constructor |
Description |
| GInfoWindowTab(label, content) |
Creates an info window tab data structure that can be passed
in the tabs argument to
openInfoWindowTabs*() methods. |
class GInfoWindowOptions
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.
Properties
As the name of this class indicates, all
properties are optional.
| Properties |
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. |
| 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) |
class GMarker
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
| Constructor |
Description |
| GMarker(latlng, icon?, inert?) |
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, opts?) |
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) |
Methods
Before these methods can be invoked, the marker
must be added to a map.
| Methods |
Return Value |
Description |
| openInfoWindow(content, opts?) |
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, opts?) |
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,
opts?) |
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, opts?) |
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, opts?) |
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, opts?) |
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,
opts?) |
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, opts?) |
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?) |
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) |
none |
Sets the geographical coordinates of the point at which this
marker is anchored. (Deprecated since 2.88) |
| setLatLng(latlng) |
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) |
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) |
Events
All these events fire only if the marker is not
inert (see constructor).
| Events |
Arguments |
Description |
| click |
none |
This event is fired when the marker icon was clicked. Notice
that this event will also fire for the map, with the marker
passed as the first argument to the event handler there. |
| dblclick |
none |
This event is fired when the marker icon was
double-clicked. Notice that this event will not fire
for the map, because the map centers on double-click as a
hardwired behavior. |
| mousedown |
none |
This event is fired when the DOM mousedown event is fired on
the marker icon. Notice that the marker will stop the mousedown
DOM event, so that it doesn't cause the map to start
dragging. |
| mouseup |
none |
This event is fired for the DOM mouseup on the
marker. Notice that the marker will not stop the
mousedown DOM event, because it will not confuse the drag
handler of the map. |
| mouseover |
none |
This event is fired when the mouse enters the area of the
marker icon. |
| mouseout |
none |
This event is fired when the mouse leaves the area of the
marker icon. |
| infowindowopen |
none |
This event is fired when the info window of the map was
opened through this marker. |
| infowindowbeforeclose |
none |
This event is fired before the info window of the map that was
opened through this marker is closed. (Since 2.83) |
| infowindowclose |
none |
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 |
none |
This event is fired when the marker is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
| dragstart |
none |
If the marker is enabled for dragging, this event is fired
when the marker dragging begins. |
| drag |
none |
If the marker is enabled for dragging, this event is fired
when the marker is being dragged. |
| dragend |
none |
If the marker is enabled for dragging, this event is fired
when the marker ceases to be dragged. |
| visibilitychanged |
isVisible |
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) |
class GMarkerOptions
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.
Properties
As the name of this class indicates, all
properties are optional.
| Properties |
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) |
class GPolyline
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
| Constructor |
Description |
| GPolyline(latlngs, color?, weight?, opacity?, opts?) |
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. |
Factory Methods
| Factory Methods |
Return Value |
Description |
| fromEncoded(color?, weight?,
opacity?, latlngs,
zoomFactor, levels,
numLevels) |
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) |
Methods
| Methods |
Return Value |
Description |
| getVertexCount() |
Number |
Returns the number of vertices in the polyline. (Since 2.46) |
| getVertex(index) |
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) |
| 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) |
Events
| Events |
Arguments |
Description |
| remove |
none |
This event is fired when the polyline is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
| visibilitychanged |
isVisible |
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 |
This event is fired when the polyline is clicked. 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) |
class GPolylineOptions
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.
Properties
As the name of this class indicates, all
properties are optional.
| Properties |
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) |
class GPolygon
This is very similar to a GPolyline,
except that you can additionally specify a fill color and opacity.
Constructor
| Constructor |
Description |
| GPolygon(latlngs, strokeColor?,
strokeWeight?, strokeOpacity?, fillColor?,
fillOpacity?, opts?) |
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) |
Factory Methods
| Factory Methods |
Return Value |
Description |
| fromEncoded(polylines,
fill?, color?,
opacity?, outline?) |
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) |
Methods
| Methods |
Return Value |
Description |
| getVertexCount() |
Number |
Returns the number of vertices in the polygon. (Since 2.69) |
| getVertex(index) |
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) |
| 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) |
Events
| Events |
Arguments |
Description |
| remove |
none |
This event is fired when the polygon is removed from the
map, using GMap2.removeOverlay() or
GMap2.clearOverlays(). |
| visibilitychanged |
isVisible |
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 |
This event is fired when the polygon is clicked. 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>) |
class GPolygonOptions
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.
Properties
As the name of this class indicates, all
properties are optional.
| Properties |
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) |
class GScreenOverlay
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
| Constructor |
Description |
| GScreenOverlay(imageUrl, screenXY,
overlayXY, size) |
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) |
Methods
| Methods |
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) |
Events
| Events |
Arguments |
Description |
| visibilitychanged |
isVisible |
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) |
class GScreenPoint
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
| Constructor |
Description |
| GScreenPoint(x, y, xunits?, yunits?) |
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) |
Properties
| Properties |
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. |
class GScreenSize
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
| Constructor |
Description |
| GScreenSize(width, height, xunits?, yunits?) |
Creates a GScreenSize object. The width and height
coordinates can either represent fractional or pixel size by passing in "fraction"
or "pixel" to the xunits and yunits parameters.
The default value for the width and height arguments is "pixel."
(Since 2.92) |
Properties
| Properties |
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 "pixel" 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 "pixel" for pixel positioning. Defaults to pixel positioning. |
class GGroundOverlay
This object creates a rectangular image overlay on the
map, whose boundaries are defined by GLatLngBounds.
Constructor
| Constructor |
Description |
| GGroundOverlay(imageUrl, bounds) |
Creates a ground overlay from an image URL and its bounds. (Since 2.79) |
Methods
| Methods |
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) |
Events
| Events |
Arguments |
Description |
| visibilitychanged |
isVisible |
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) |
class GIcon
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
| Constructor |
Description |
| GIcon(copy?, image?) |
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. |
Constants
| Constants |
Description |
| G_DEFAULT_ICON |
The default icon used by markers. |
Properties
| Properties |
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 the foreground icon image used for printed
maps. It must be the same size as the main icon image given by
image. |
| mozPrintImage |
String |
The URL of the foreground icon image used for printed maps
in Firefox/Mozilla. It must be the same size as the main icon
image given by image. |
| 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 |
Array of 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) |
class GPoint
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
| Constructor |
Description |
| GPoint(x, y) |
Creates a GPoint object. |
Properties
| Properties |
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.) |
Methods
| Methods |
Return Value |
Description |
| equals(other) |
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. |
class GSize
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
| Constructor |
Description |
| GSize(width, height) |
Creates a GSize object. |
Properties
| Properties |
Type |
Description |
| width |
Number |
The width parameter. |
| height |
Number |
The height parameter. |
Methods
| Methods |
Return Value |
Description |
| equals(other) |
|