You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps JavaScript API

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps JavaScript API and related services
  3. Create appropriate keys
Continue

Google Maps JavaScript API V3 Reference

Last updated Tuesday, April 03, 2018

Welcome to the reference for the experimental release of the Google Maps JavaScript API. This is an index of all the classes, methods, and interfaces in the API. Click the name of any item to see detailed documentation.

This reference is kept up to date with the latest changes to the API. Please consult the Javascript Maps API release notes for information on what's new in each release.

Maps

Maps

Map class

Methods: fitBounds, getBounds, getCenter, getClickableIcons, getDiv, getHeading, getMapTypeId, getProjection, getStreetView, getTilt, getZoom, panBy, panTo, panToBounds, setCenter, setClickableIcons, setHeading, setMapTypeId, setOptions, setStreetView, setTilt, setZoom

Properties: controls, data, mapTypes, overlayMapTypes

Events: bounds_changed, center_changed, click, dblclick, drag, dragend, dragstart, heading_changed, idle, maptypeid_changed, mousemove, mouseout, mouseover, projection_changed, rightclick, tilesloaded, tilt_changed, zoom_changed

MapOptions interface

Properties: backgroundColor, center, clickableIcons, disableDefaultUI, disableDoubleClickZoom, draggable, draggableCursor, draggingCursor, fullscreenControl, fullscreenControlOptions, gestureHandling, heading, keyboardShortcuts, mapTypeControl, mapTypeControlOptions, mapTypeId, maxZoom, minZoom, noClear, panControl, panControlOptions, rotateControl, rotateControlOptions, scaleControl, scaleControlOptions, scrollwheel, streetView, streetViewControl, streetViewControlOptions, styles, tilt, zoom, zoomControl, zoomControlOptions

MapTypeStyle interface

Properties: elementType, featureType, stylers

MouseEvent interface

Methods: stop

Properties: latLng

IconMouseEvent interface

Properties: placeId

MapTypeId constants

Constants: HYBRID, ROADMAP, SATELLITE, TERRAIN

MapTypeRegistry class

Methods: set

TrafficLayer class

Methods: getMap, setMap, setOptions

TrafficLayerOptions interface

Properties: autoRefresh, map

TransitLayer class

Methods: getMap, setMap

BicyclingLayer class

Methods: getMap, setMap

Coordinates

LatLng class

Methods: equals, lat, lng, toJSON, toString, toUrlValue

LatLngLiteral interface

Properties: lat, lng

LatLngBounds class

Methods: contains, equals, extend, getCenter, getNorthEast, getSouthWest, intersects, isEmpty, toJSON, toSpan, toString, toUrlValue, union

LatLngBoundsLiteral interface

Properties: east, north, south, west

Point class

Methods: equals, toString

Properties: x, y

Size class

Methods: equals, toString

Properties: height, width

Padding interface

Properties: bottom, left, right, top

Event system

event namespace

Static Methods: addDomListener, addDomListenerOnce, addListener, addListenerOnce, clearInstanceListeners, clearListeners, removeListener, trigger

MapsEventListener interface

Methods: remove

MVCObject class

Methods: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll

MVCArray class

Methods: clear, forEach, getArray, getAt, getLength, insertAt, pop, push, removeAt, setAt

Events: insert_at, remove_at, set_at

Controls

FullscreenControlOptions interface

Properties: position

MapTypeControlOptions interface

Properties: mapTypeIds, position, style

MapTypeControlStyle constants

Constants: DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR

MotionTrackingControlOptions interface

Properties: position

PanControlOptions interface

Properties: position

RotateControlOptions interface

Properties: position

ScaleControlOptions interface

Properties: style

ScaleControlStyle constants

Constants: DEFAULT

StreetViewControlOptions interface

Properties: position

ZoomControlOptions interface

Properties: position

ControlPosition constants

Constants: BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT_BOTTOM, LEFT_CENTER, LEFT_TOP, RIGHT_BOTTOM, RIGHT_CENTER, RIGHT_TOP, TOP_CENTER, TOP_LEFT, TOP_RIGHT

Geometry Library

encoding namespace

Static Methods: decodePath, encodePath

spherical namespace

Static Methods: computeArea, computeDistanceBetween, computeHeading, computeLength, computeOffset, computeOffsetOrigin, computeSignedArea, interpolate

poly namespace

Static Methods: containsLocation, isLocationOnEdge

Drawing on the map

Marker

Marker class

Methods: getAnimation, getClickable, getCursor, getDraggable, getIcon, getLabel, getMap, getOpacity, getPosition, getShape, getTitle, getVisible, getZIndex, setAnimation, setClickable, setCursor, setDraggable, setIcon, setLabel, setMap, setOpacity, setOptions, setPosition, setShape, setTitle, setVisible, setZIndex

Constants: MAX_ZINDEX

Events: animation_changed, click, clickable_changed, cursor_changed, dblclick, drag, dragend, draggable_changed, dragstart, flat_changed, icon_changed, mousedown, mouseout, mouseover, mouseup, position_changed, rightclick, shape_changed, title_changed, visible_changed, zindex_changed

MarkerOptions interface

Properties: anchorPoint, animation, clickable, crossOnDrag, cursor, draggable, icon, label, map, opacity, optimized, position, shape, title, visible, zIndex

Icon interface

Properties: anchor, labelOrigin, origin, scaledSize, size, url

MarkerLabel interface

Properties: color, fontFamily, fontSize, fontWeight, text

MarkerShape interface

Properties: coords, type

Symbol interface

Properties: anchor, fillColor, fillOpacity, labelOrigin, path, rotation, scale, strokeColor, strokeOpacity, strokeWeight

SymbolPath constants

Constants: BACKWARD_CLOSED_ARROW, BACKWARD_OPEN_ARROW, CIRCLE, FORWARD_CLOSED_ARROW, FORWARD_OPEN_ARROW

Animation constants

Constants: BOUNCE, DROP

Info Window

InfoWindow class

Methods: close, getContent, getPosition, getZIndex, open, setContent, setOptions, setPosition, setZIndex

Events: closeclick, content_changed, domready, position_changed, zindex_changed

InfoWindowOptions interface

Properties: content, disableAutoPan, maxWidth, pixelOffset, position, zIndex

Polygons

Polyline class

Methods: getDraggable, getEditable, getMap, getPath, getVisible, setDraggable, setEditable, setMap, setOptions, setPath, setVisible

Events: click, dblclick, drag, dragend, dragstart, mousedown, mousemove, mouseout, mouseover, mouseup, rightclick

PolylineOptions interface

Properties: clickable, draggable, editable, geodesic, icons, map, path, strokeColor, strokeOpacity, strokeWeight, visible, zIndex

IconSequence interface

Properties: fixedRotation, icon, offset, repeat

Polygon class

Methods: getDraggable, getEditable, getMap, getPath, getPaths, getVisible, setDraggable, setEditable, setMap, setOptions, setPath, setPaths, setVisible

Events: click, dblclick, drag, dragend, dragstart, mousedown, mousemove, mouseout, mouseover, mouseup, rightclick

PolygonOptions interface

Properties: clickable, draggable, editable, fillColor, fillOpacity, geodesic, map, paths, strokeColor, strokeOpacity, strokePosition, strokeWeight, visible, zIndex

PolyMouseEvent interface

Properties: edge, path, vertex

Rectangle class

Methods: getBounds, getDraggable, getEditable, getMap, getVisible, setBounds, setDraggable, setEditable, setMap, setOptions, setVisible

Events: bounds_changed, click, dblclick, drag, dragend, dragstart, mousedown, mousemove, mouseout, mouseover, mouseup, rightclick

RectangleOptions interface

Properties: bounds, clickable, draggable, editable, fillColor, fillOpacity, map, strokeColor, strokeOpacity, strokePosition, strokeWeight, visible, zIndex

Circle class

Methods: getBounds, getCenter, getDraggable, getEditable, getMap, getRadius, getVisible, setCenter, setDraggable, setEditable, setMap, setOptions, setRadius, setVisible

Events: center_changed, click, dblclick, drag, dragend, dragstart, mousedown, mousemove, mouseout, mouseover, mouseup, radius_changed, rightclick

CircleOptions interface

Properties: center, clickable, draggable, editable, fillColor, fillOpacity, map, radius, strokeColor, strokeOpacity, strokePosition, strokeWeight, visible, zIndex

StrokePosition constants

Constants: CENTER, INSIDE, OUTSIDE

Data

Data class

Methods: add, addGeoJson, contains, forEach, getControlPosition, getControls, getDrawingMode, getFeatureById, getMap, getStyle, loadGeoJson, overrideStyle, remove, revertStyle, setControlPosition, setControls, setDrawingMode, setMap, setStyle, toGeoJson

Events: addfeature, click, dblclick, mousedown, mouseout, mouseover, mouseup, removefeature, removeproperty, rightclick, setgeometry, setproperty

Data.DataOptions interface

Properties: controlPosition, controls, drawingMode, featureFactory, map, style

Data.GeoJsonOptions interface

Properties: idPropertyName

Data.StyleOptions interface

Properties: clickable, cursor, draggable, editable, fillColor, fillOpacity, icon, shape, strokeColor, strokeOpacity, strokeWeight, title, visible, zIndex

Data.StylingFunction typedef
Data.Feature class

Methods: forEachProperty, getGeometry, getId, getProperty, removeProperty, setGeometry, setProperty, toGeoJson

Events: removeproperty, setgeometry, setproperty

Data.FeatureOptions interface

Properties: geometry, id, properties

Data.Geometry interface

Methods: forEachLatLng, getType

Data.Point class

Methods: forEachLatLng, get, getType

Data.MultiPoint class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.LineString class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.MultiLineString class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.LinearRing class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.Polygon class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.MultiPolygon class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.GeometryCollection class

Methods: forEachLatLng, getArray, getAt, getLength, getType

Data.MouseEvent interface

Properties: feature

Data.AddFeatureEvent interface

Properties: feature

Data.RemoveFeatureEvent interface

Properties: feature

Data.SetGeometryEvent interface

Properties: feature, newGeometry, oldGeometry

Data.SetPropertyEvent interface

Properties: feature, name, newValue, oldValue

Data.RemovePropertyEvent interface

Properties: feature, name, oldValue

DOM elements

OverlayView class

Methods: draw, getMap, getPanes, getProjection, onAdd, onRemove, setMap

MapPanes interface

Properties: floatPane, mapPane, markerLayer, overlayLayer, overlayMouseTarget

MapCanvasProjection interface

Methods: fromContainerPixelToLatLng, fromDivPixelToLatLng, fromLatLngToContainerPixel, fromLatLngToDivPixel, getWorldWidth

KML

KmlLayer class

Methods: getDefaultViewport, getMap, getMetadata, getStatus, getUrl, getZIndex, setMap, setOptions, setUrl, setZIndex

Events: click, defaultviewport_changed, status_changed

KmlLayerOptions interface

Properties: clickable, map, preserveViewport, screenOverlays, suppressInfoWindows, url, zIndex

KmlLayerMetadata interface

Properties: author, description, hasScreenOverlays, name, snippet

KmlLayerStatus constants

Constants: DOCUMENT_NOT_FOUND, DOCUMENT_TOO_LARGE, FETCH_ERROR, INVALID_DOCUMENT, INVALID_REQUEST, LIMITS_EXCEEDED, OK, TIMED_OUT, UNKNOWN

KmlMouseEvent interface

Properties: featureData, latLng, pixelOffset

KmlFeatureData interface

Properties: author, description, id, infoWindowHtml, name, snippet

KmlAuthor interface

Properties: email, name, uri

Fusion Tables

FusionTablesLayer class

Methods: getMap, setMap, setOptions

Events: click

FusionTablesLayerOptions interface

Properties: clickable, heatmap, map, query, styles, suppressInfoWindows

FusionTablesQuery interface

Properties: from, limit, offset, orderBy, select, where

FusionTablesStyle interface

Properties: markerOptions, polygonOptions, polylineOptions, where

FusionTablesHeatmap interface

Properties: enabled

FusionTablesMarkerOptions interface

Properties: iconName

FusionTablesPolygonOptions interface

Properties: fillColor, fillOpacity, strokeColor, strokeOpacity, strokeWeight

FusionTablesPolylineOptions interface

Properties: strokeColor, strokeOpacity, strokeWeight

FusionTablesMouseEvent interface

Properties: infoWindowHtml, latLng, pixelOffset, row

FusionTablesCell interface

Properties: columnName, value

Image overlays

MapType interface

Methods: getTile, releaseTile

Properties: alt, maxZoom, minZoom, name, radius, tileSize

Projection interface

Methods: fromLatLngToPoint, fromPointToLatLng

ImageMapType class

Methods: getOpacity, getTile, releaseTile, setOpacity

Properties: alt, maxZoom, minZoom, name, projection, radius, tileSize

Events: tilesloaded

ImageMapTypeOptions interface

Properties: alt, getTileUrl, maxZoom, minZoom, name, opacity, tileSize

GroundOverlay class

Methods: getBounds, getMap, getOpacity, getUrl, setMap, setOpacity

Events: click, dblclick

GroundOverlayOptions interface

Properties: clickable, map, opacity

StyledMapType class

Methods: getTile, releaseTile

Properties: alt, maxZoom, minZoom, name, projection, radius, tileSize

StyledMapTypeOptions interface

Properties: alt, maxZoom, minZoom, name

Drawing Library

DrawingManager class

Methods: getDrawingMode, getMap, setDrawingMode, setMap, setOptions

Events: circlecomplete, markercomplete, overlaycomplete, polygoncomplete, polylinecomplete, rectanglecomplete

DrawingManagerOptions interface

Properties: circleOptions, drawingControl, drawingControlOptions, drawingMode, map, markerOptions, polygonOptions, polylineOptions, rectangleOptions

DrawingControlOptions interface

Properties: drawingModes, position

OverlayCompleteEvent interface

Properties: overlay, type

OverlayType constants

Constants: CIRCLE, MARKER, POLYGON, POLYLINE, RECTANGLE

Heatmaps

HeatmapLayer class

Methods: getData, getMap, setData, setMap, setOptions

HeatmapLayerOptions interface

Properties: data, dissipating, gradient, map, maxIntensity, opacity, radius

WeightedLocation interface

Properties: location, weight

Max Zoom

MaxZoomService class

Methods: getMaxZoomAtLatLng

MaxZoomResult interface

Properties: status, zoom

MaxZoomStatus constants

Constants: ERROR, OK

Street View

Rendering

StreetViewPanorama class

Methods: getLinks, getLocation, getMotionTracking, getPano, getPhotographerPov, getPosition, getPov, getStatus, getVisible, getZoom, registerPanoProvider, setLinks, setMotionTracking, setOptions, setPano, setPosition, setPov, setVisible, setZoom

Properties: controls

Events: closeclick, pano_changed, position_changed, pov_changed, resize, status_changed, visible_changed, zoom_changed

StreetViewPanoramaOptions interface

Properties: addressControl, addressControlOptions, clickToGo, disableDefaultUI, disableDoubleClickZoom, enableCloseButton, fullscreenControl, fullscreenControlOptions, imageDateControl, linksControl, motionTracking, motionTrackingControl, motionTrackingControlOptions, panControl, panControlOptions, pano, position, pov, scrollwheel, showRoadLabels, visible, zoom, zoomControl, zoomControlOptions

StreetViewAddressControlOptions interface

Properties: position

PanoProviderOptions interface

Properties: cors

StreetViewTileData interface

Methods: getTileUrl

Properties: centerHeading, tileSize, worldSize

StreetViewPov interface

Properties: heading, pitch

StreetViewCoverageLayer class

Methods: getMap, setMap

Service

StreetViewService class

Methods: getPanorama

StreetViewStatus constants

Constants: OK, UNKNOWN_ERROR, ZERO_RESULTS

StreetViewLocationRequest interface

Properties: location, preference, radius, source

StreetViewPanoRequest interface

Properties: pano

StreetViewLocation interface

Properties: description, latLng, pano, shortDescription

StreetViewPreference constants

Constants: BEST, NEAREST

StreetViewSource constants

Constants: DEFAULT, OUTDOOR

StreetViewPanoramaData interface

Properties: copyright, imageDate, links, location, tiles

Properties: description, heading, pano

Places

Places Widgets

Autocomplete class

Methods: getBounds, getPlace, setBounds, setComponentRestrictions, setOptions, setTypes

Events: place_changed

AutocompleteOptions interface

Properties: bounds, componentRestrictions, placeIdOnly, strictBounds, types

AutocompletePrediction interface

Properties: description, matched_substrings, place_id, terms, types

PredictionTerm interface

Properties: offset, value

PredictionSubstring interface

Properties: length, offset

AutocompleteService class

Methods: getPlacePredictions, getQueryPredictions

AutocompletionRequest interface

Properties: bounds, componentRestrictions, input, location, offset, radius, types

ComponentRestrictions interface

Properties: country

QueryAutocompletePrediction interface

Properties: description, matched_substrings, place_id, terms

QueryAutocompletionRequest interface

Properties: bounds, input, location, offset, radius

RadarSearchRequest interface

Properties: bounds, keyword, location, name, radius, type

RankBy constants

Constants: DISTANCE, PROMINENCE

Methods: getBounds, getPlaces, setBounds

Events: places_changed

SearchBoxOptions interface

Properties: bounds

TextSearchRequest interface

Properties: bounds, location, query, radius, type

Places Service

PlaceAspectRating interface

Properties: rating, type

PlaceDetailsRequest interface

Properties: placeId

PlaceGeometry interface

Properties: location, viewport

PlacePhoto interface

Methods: getUrl

Properties: height, html_attributions, width

PhotoOptions interface

Properties: maxHeight, maxWidth

PlaceResult interface

Properties: address_components, aspects, formatted_address, formatted_phone_number, geometry, html_attributions, icon, international_phone_number, name, permanently_closed, photos, place_id, price_level, rating, reviews, types, url, utc_offset, vicinity, website

PlaceReview interface

Properties: aspects, author_name, author_url, language, text

PlaceSearchPagination interface

Methods: nextPage

Properties: hasNextPage

PlaceSearchRequest interface

Properties: bounds, keyword, location, maxPriceLevel, minPriceLevel, name, openNow, radius, rankBy, type

PlacesService class

Methods: getDetails, nearbySearch, radarSearch, textSearch

PlacesServiceStatus constants

Constants: INVALID_REQUEST, NOT_FOUND, OK, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR, ZERO_RESULTS

Geocoder

Geocoder class

Methods: geocode

GeocoderRequest interface

Properties: address, bounds, componentRestrictions, location, placeId, region

GeocoderComponentRestrictions interface

Properties: administrativeArea, country, locality, postalCode, route

GeocoderStatus constants

Constants: ERROR, INVALID_REQUEST, OK, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR, ZERO_RESULTS

GeocoderResult interface

Properties: address_components, formatted_address, geometry, partial_match, place_id, postcode_localities, types

GeocoderAddressComponent interface

Properties: long_name, short_name, types

GeocoderGeometry interface

Properties: bounds, location, location_type, viewport

GeocoderLocationType constants

Constants: APPROXIMATE, GEOMETRIC_CENTER, RANGE_INTERPOLATED, ROOFTOP

Routes

Directions

DirectionsService class

Methods: route

DirectionsRequest interface

Properties: avoidFerries, avoidHighways, avoidTolls, destination, drivingOptions, optimizeWaypoints, origin, provideRouteAlternatives, region, transitOptions, travelMode, unitSystem, waypoints

DirectionsStatus constants

Constants: INVALID_REQUEST, MAX_WAYPOINTS_EXCEEDED, NOT_FOUND, OK, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR, ZERO_RESULTS

DirectionsResult interface

Properties: geocoded_waypoints, routes

DirectionsRenderer class

Methods: getDirections, getMap, getPanel, getRouteIndex, setDirections, setMap, setOptions, setPanel, setRouteIndex

Events: directions_changed

DirectionsRendererOptions interface

Properties: directions, draggable, hideRouteList, infoWindow, map, markerOptions, panel, polylineOptions, preserveViewport, routeIndex, suppressBicyclingLayer, suppressInfoWindows, suppressMarkers, suppressPolylines

DirectionsWaypoint interface

Properties: location, stopover

DirectionsGeocodedWaypoint interface

Properties: partial_match, place_id, types

DirectionsRoute interface

Properties: bounds, copyrights, fare, legs, overview_path, overview_polyline, warnings, waypoint_order

DirectionsLeg interface

Properties: arrival_time, departure_time, distance, duration, duration_in_traffic, end_address, end_location, start_address, start_location, steps, via_waypoints

DirectionsStep interface

Properties: distance, duration, end_location, instructions, path, start_location, steps, transit, travel_mode

Place interface

Properties: location, placeId, query

TravelMode constants

Constants: BICYCLING, DRIVING, TRANSIT, WALKING

DrivingOptions interface

Properties: departureTime, trafficModel

TrafficModel constants

Constants: BEST_GUESS, OPTIMISTIC, PESSIMISTIC

TransitOptions interface

Properties: arrivalTime, departureTime, modes, routingPreference

TransitMode constants

Constants: BUS, RAIL, SUBWAY, TRAIN, TRAM

TransitRoutePreference constants

Constants: FEWER_TRANSFERS, LESS_WALKING

TransitFare interface

Properties: currency, value

TransitDetails interface

Properties: arrival_stop, arrival_time, departure_stop, departure_time, headsign, headway, line, num_stops

TransitStop interface

Properties: location, name

TransitLine interface

Properties: agencies, color, icon, name, short_name, text_color, url, vehicle

TransitAgency interface

Properties: name, phone, url

TransitVehicle interface

Properties: icon, local_icon, name, type

VehicleType constants

Constants: BUS, CABLE_CAR, COMMUTER_TRAIN, FERRY, FUNICULAR, GONDOLA_LIFT, HEAVY_RAIL, HIGH_SPEED_TRAIN, INTERCITY_BUS, METRO_RAIL, MONORAIL, OTHER, RAIL, SHARE_TAXI, SUBWAY, TRAM, TROLLEYBUS

UnitSystem constants

Constants: IMPERIAL, METRIC

Distance interface

Properties: text, value

Duration interface

Properties: text, value

Time interface

Properties: text, time_zone, value

Distance Matrix

DistanceMatrixService class

Methods: getDistanceMatrix

DistanceMatrixRequest interface

Properties: avoidFerries, avoidHighways, avoidTolls, destinations, drivingOptions, origins, region, transitOptions, travelMode, unitSystem

DistanceMatrixResponse interface

Properties: destinationAddresses, originAddresses, rows

DistanceMatrixResponseRow interface

Properties: elements

DistanceMatrixResponseElement interface

Properties: distance, duration, duration_in_traffic, fare, status

DistanceMatrixStatus constants

Constants: INVALID_REQUEST, MAX_DIMENSIONS_EXCEEDED, MAX_ELEMENTS_EXCEEDED, OK, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR

DistanceMatrixElementStatus constants

Constants: NOT_FOUND, OK, ZERO_RESULTS

Elevation

ElevationService class

Methods: getElevationAlongPath, getElevationForLocations

LocationElevationRequest interface

Properties: locations

PathElevationRequest interface

Properties: path, samples

ElevationResult interface

Properties: elevation, location, resolution

ElevationStatus constants

Constants: INVALID_REQUEST, OK, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR

傳送您對下列選項的寶貴意見...

這個網頁
Google Maps JavaScript API
Google Maps JavaScript API
需要協助嗎?請前往我們的支援網頁