Example
Specify the attributes/options of the map:
var mapOpt = {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
Try it Β»
Definition and Usage
The MapOptions object holds the initialization variables/options for the map.
Syntax
var mapOpt = {
_property_:_value_,
_property_:_value_,
etc.
};
Properties of MapOptions
| Property | Type | Description |
|---|---|---|
| backgroundColor | string | Specifies the background color of the Map . |
| center | LatLng | Required. Specifies the default map center. |
| disableDefaultUI | boolean | Enables/disables all default controls. |
| disableDoubleClickZoom | boolean | Enables/disables zooming and centering on double-click. |
| draggable | boolean | When set to False, prevents the map from being dragged. Default is True. |
| draggableCursor | string | Specifies the name/URL of the cursor to display when over a draggable object. |
| draggingCursor | string | Specifies the name/URL of the cursor to display while an object is being dragged. |
| heading | number | Specifies the orientation of aerial imagery in degrees. |
| keyboardShortcuts | boolean | When set to False, prevents the map from being controlled by keyboard. Default is True. |
| mapMaker | boolean | Set to True if you want to use Map Maker tiles instead of regular tiles. |
| mapTypeControl | boolean | Specifies the default enabled/disabled state of the Map type control. |
| mapTypeControlOptions | MapTypeControlOptions | The default display options for the Map type control. |
| mapTypeId | MapTypeId | Required. The default map type. |
| maxZoom | number | The maximum zoom level of the map. |
| minZoom | number | The minimum zoom level of the map. |
| noClear | boolean | If set to True, does not clear the contents of the Map . |
| overviewMapControl | boolean | The enabled/disabled state of the Overview Map control. |
| overviewMapControlOptions | OverviewMapControlOptions | The display options for the Overview Map control. |
| panControl | boolean | The enabled/disabled state of the Pan control. |
| panControlOptions | PanControlOptions | The display options for the Pan control. |
| rotateControl | boolean | The enabled/disabled state of the Rotate control. |
| rotateControlOptions | RotateControlOptions | The display options for the Rotate control. |
| scaleControl | boolean | The default enabled/disabled state of the Scale control. |
| scaleControlOptions | ScaleControlOptions | The default display options for the Scale control. |
| scrollwheel | boolean | When set to False, disables scrollwheel zooming on the map. Default is True. |
| streetView | StreetViewPanorama | The StreetViewPanorama to display when the Street View pegman figure icon is dropped on the map. |
| streetViewControl | boolean | The default enabled/disabled state of the Street View Pegman control. |
| streetViewControlOptions | StreetViewControlOptions | The default display options for the Street View Pegman control. |
| styles | Array.<MapStyleType> | The styles to apply to each of the default map types. |
| tilt | number | The angle at which the camera tilts toward the map, in degrees (0 and 45). |
| zoom | number | Required. The default zoom level of the Map. |
| zoomControl | boolean | The enabled/disabled state of the Zoom control. |
| zoomControlOptions | ZoomControlOptions | The display options for the Zoom control. |
YouTip