Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 3 — The Google Maps API 43


Table 3-1: Configuration Map Options

Method Description

enableDragging() Enables dynamic dragging (enabled by default).
disableDragging() Disables dynamic dragging.
draggingEnabled() Returns true if dynamic dragging is enabled.
enableInfoWindow() Enables the info window on this map (enabled by default).
disableInfoWindow() Disables the info window on this map.
infoWindowEnabled() Returns true if the info window is enabled on this map.

To add or remove one of the control types on a map, use the methods in Table 3-2. The con-
trolargument uses one of the constants specified in the “Controls” section, earlier in this
chapter.


Table 3-2: Adding and Removing Controls on a Map

Method Description

addControl(control) Adds a map control to the map.
removeControl(control) Removes a map control from the map.

You can get status information about the map, such as the current location, zoom level, and
area shown using the methods in Table 3-3. This table also shows the methods that allow you
to modify these settings.


Table 3-3: Methods for Getting and Setting Status Information

Method Description

getCenterLatLng() Returns the center point of the map in latitude/longitude
coordinates.
getBoundsLatLng() Returns the latitude/longitude bounds of the map viewport.
getSpanLatLng() Returns the width and height of the map viewport in
latitude/longitude ticks.
getZoomLevel() Returns the integer zoom level of the map.
centerAtLatLng(latLng) Centers the map at the given point.

Continued
Free download pdf