Example
Specify properties/options for a map:
var mapOpt = {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
Try it Yourself »
Definition and Usage
The MapOptions object holds the map initialization variables/options.
Syntax
var mapOpt = {
property:value,
property:value,
etc.
};
Properties of MapOptions
Property | Type | Description |
---|---|---|
backgroundColor | string | Specifies a background color for the Map <div> |
center | LatLng | Required. Specifies the default map center |
disableDefaultUI | boolean | Enables/Disables all default controls |
disableDoubleClickZoom | boolean | Enables/Disables zoom and center on double-click |
draggable | boolean | False prevents the map from being dragged. Default is true |
draggableCursor | string | Specifies the name/URL of the cursor to display on a draggable object |
draggingCursor | string | Specifies the name/URL of the cursor to display when an object is dragging |
heading | number | Specifies the heading for aerial imagery in degrees |
keyboardShortcuts | boolean | False prevents the map from being controlled by the keybord. Default is true |
mapMaker | boolean | True if Map Maker tiles should be used 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 for the map |
minZoom | number | The minimum zoom level for the map |
noClear | boolean | If true, do not clear the contents of the Map <div> |
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 | False disables scrollwheel zooming on the map. Default is true |
streetView | StreetViewPanorama | A StreetViewPanorama to display when the Street View pegman 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> | Styles to apply to each of the default map types |
tilt | number | The angle of incidence of the map as measured in degrees from the viewport plane to the map plane (0 and 45) |
zoom | number | Required. The default Map zoom level |
zoomControl | boolean | The enabled/disabled state of the Zoom control |
zoomControlOptions | ZoomControlOptions | The display options for the Zoom control |