google.maps.Map 对象

构造 描述
Map(mapDiv:Node, opts?:MapOptions) Creates a new map inside of the given HTML container, which is typically a DIV element.

用给定的容器新建地图, 常用的是 DIV.

 

方法 返回值 描述
fitBounds(bounds:LatLngBounds) None Sets the viewport to contain the given bounds.
getBounds() LatLngBounds Returns the lat/lng bounds of the current viewport. If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive. If the map is not yet initialized (i.e. the mapType is still null), or center and zoom have not been set then the result is null or undefined.
getCenter() LatLng Returns the position displayed at the center of the map. Note that thisLatLng object is not wrapped. See LatLng for more information.
getDiv() Node  
getHeading() number Returns the compass heading of aerial imagery. The heading value is measured in degrees (clockwise) from cardinal direction North.
getMapTypeId() MapTypeId|string  
getProjection() Projection Returns the current Projection. If the map is not yet initialized (i.e. the mapType is still null) then the result is null. Listen toprojection_changed and check its value to ensure it is not null.
getStreetView() StreetViewPanorama Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView(). Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.
getTilt() number Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. The result will be 0 for imagery taken directly overhead or 45 for 45° imagery. 45° imagery is only available for SATELLITE and HYBRID map types, within some locations, and at some zoom levels. Note: This method does not return the value set bysetTilt. See setTilt for details.
getZoom() number  
panBy(x:number, y:number) None Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).
panTo(latLng:LatLng|LatLngLiteral) None Changes the center of the map to the given LatLng. If the change is less than both the width and height of the map, the transition will be smoothly animated.
panToBounds(latLngBounds:LatLngBounds) None Pans the map by the minimum amount necessary to contain the givenLatLngBounds. It makes no guarantee where on the map the bounds will be, except that as much of the bounds as possible will be visible. The bounds will be positioned inside the area bounded by the map type and navigation (pan, zoom, and Street View) controls, if they are present on the map. If the bounds is larger than the map, the map will be shifted to include the northwest corner of the bounds. If the change in the map's position is less than both the width and height of the map, the transition will be smoothly animated.
setCenter(latlng:LatLng|LatLngLiteral) None  
setHeading(heading:number) None Sets the compass heading for aerial imagery measured in degrees from cardinal direction North.
setMapTypeId(mapTypeId:MapTypeId|string) None  
setOptions(options:MapOptions) None  
setStreetView(panorama:StreetViewPanorama) None Binds a StreetViewPanorama to the map. This panorama overrides the default StreetViewPanorama, allowing the map to bind to an external panorama outside of the map. Setting the panorama to null binds the default embedded panorama back to the map.
setTilt(tilt:number) None Controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45. setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(45) causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for SATELLITE and HYBRID map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value set by setTilt. Because getTilt and setTilt refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects.
setZoom(zoom:number) None  
属性 Type 描述
controls Array.<MVCArray.<Node>> Additional controls to attach to the map. To add a control to the map, add the control's <div> to theMVCArray corresponding to the ControlPosition where it should be rendered.
data Data An instance of Data, bound to the map. Add features to this Data object to conveniently display them on this map.
mapTypes MapTypeRegistry A registry of MapType instances by string ID.
overlayMapTypes MVCArray.<MapType> Additional map types to overlay.
事件 参数 描述
bounds_changed None This event is fired when the viewport bounds have changed.
center_changed None This event is fired when the map center property changes.
click MouseEvent This event is fired when the user clicks on the map (but not when they click on a marker or infowindow).
dblclick MouseEvent This event is fired when the user double-clicks on the map. Note that the click event will also fire, right before this one.
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.
dragstart None This event is fired when the user starts dragging the map.
heading_changed None This event is fired when the map heading property changes.
idle None This event is fired when the map becomes idle after panning or zooming.
maptypeid_changed None This event is fired when the mapTypeId property changes.
mousemove MouseEvent This event is fired whenever the user's mouse moves over the map container.
mouseout MouseEvent This event is fired when the user's mouse exits the map container.
mouseover MouseEvent This event is fired when the user's mouse enters the map container.
projection_changed None This event is fired when the projection has changed.
resize None Developers should trigger this event on the map when the div changes size:google.maps.event.trigger(map, 'resize') .
rightclick MouseEvent This event is fired when the DOM contextmenu event is fired on the map container.
tilesloaded None This event is fired when the visible tiles have finished loading.
tilt_changed None This event is fired when the map tilt property changes.
zoom_changed None This event is fired when the map zoom property changes.