Initializer

mapkit.Map

Creates a map that you embed on a webpage, and initializes its display properties and other options.

Declaration

new mapkit.Map(optional String|Element parent, optional MapConstructorOptions options);

Parameters

parent

A DOM element or the ID of a DOM element to use as this map's container.

options

Options defined in MapConstructorOptions that initialize properties of the map.

Return Value

A mapkit.Map instance.

Discussion

The map's constructor takes a parent argument and an optional options argument. The map's element is inserted into the DOM as a child of parent. The map element is styled to fill the size of its parent.

A map defaults to showing the entire world.

Example Usage

Adding a map to a DIV that's on the page:

HTML

<body>
	<div id="mapContainer"></div>
</body>

JavaScript

var map = new mapkit.Map('mapContainer', { center: new mapkit.Coordinate(37.334883, -122.008977) });

See Also

Creating a Map

MapConstructorOptions

An object that contains options for initializing a map's features.