Class

mapkit.Map

An embeddable interactive map that you add to a webpage.

Declaration

interface mapkit.Map

Overview

A map is a self-contained view object that you embed on a webpage. It's possible to have multiple independent maps on a single webpage, although typically webpages need only one interactive map.

Topics

Creating a Map

mapkit.Map

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

MapConstructorOptions

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

Handling Map Events

Handling Map Events

Handle events triggered by user interactions and the framework.

addEventListener

Adds an event listener to handle events triggered by user interactions and the framework.

removeEventListener

Removes an event listener.

Accessing Interaction Properties

isRotationAvailable

A Boolean value that indicates if map rotation is available.

isRotationEnabled

A Boolean value that determines whether the user may rotate the map using the compass control or a rotate gesture.

isScrollEnabled

A Boolean value that determines whether the user may scroll the map with a pointing device or with gestures on a touchscreen.

isZoomEnabled

A Boolean value that determines whether the user may zoom in and out on the map using pinch gestures or the zoom control.

Manipulating the Visible Portion of the Map

center

The map coordinate at the center of the map view.

setCenterAnimated

Centers the map to the provided coordinate, with optional animation.

region

The area currently displayed by the map.

setRegionAnimated

Changes the map's region to the region provided, with optional animation.

rotation

The map's rotation, in degrees.

setRotationAnimated

Changes the map's rotation setting to the number of degrees specified.

visibleMapRect

The visible area of the map defined in map units.

setVisibleMapRectAnimated

Changes the map's visible map rectangle to the specified map rectangle.

cameraBoundary

Sets a constraint for the center of the map.

setCameraBoundaryAnimated

Changes the map's camera boundary with an animated transition.

cameraDistance

Sets the altitude of the camera above the center of the map.

setCameraDistanceAnimated

Changes the map's camera distance with an animated transition.

cameraZoomRange

Sets the minimum and maximum distance of the camera from the map center.

setCameraZoomRangeAnimated

Changes the map's camera zoom range with an animated transition.

Configuring the Map's Appearance

colorScheme

The map’s color scheme when displaying standard or muted standard map types.

distances

The system of measurement displayed on the map.

mapType

The type of data displayed by the map view.

padding

The map's inset margins.

showsCompass

A feature visibility setting that determines when the compass is visible.

showsMapTypeControl

A Boolean value that determines whether to display a control that lets users choose the map type.

showsZoomControl

A Boolean value that determines whether to display a control for zooming in and zooming out on a map.

showsUserLocationControl

A Boolean value that determines whether the user location control is visible.

showsPointsOfInterest

A Boolean value that determines whether the map displays points of interest.

showsScale

A feature visibility setting that determines when the map's scale is displayed.

tintColor

The CSS color that is used to paint the user interface controls on the map.

showItems

Adjusts the maps visible region to bring the specified overlays and annotations into view.

MapShowItemsOptions

Options that determine map parameters used when showing items.

Annotating the Map

annotations

An array of all the annotations on the map.

selectedAnnotation

The annotation that is selected.

annotationForCluster

A delegate method for modifying an annotation that represents a group of annotations that are combined into a cluster.

annotationsInMapRect

Returns the list of annotation objects located in the specified map rectangle.

addAnnotation

Adds an annotation to the map.

addAnnotations

Adds multiple annotations to the map.

removeAnnotation

Removes an annotation from the map.

removeAnnotations

Removes multiple annotations from the map.

Adding and Removing Overlays

overlays

An array of all of the map's overlays.

selectedOverlay

The overlay on the map that is selected.

overlaysAtPoint

Returns an array of overlays at a given point on the webpage.

addOverlay

Adds an overlay to the map.

addOverlays

Adds multiple overlays to the map.

removeOverlay

Removes an overlay from the map.

removeOverlays

Removes multiple overlays from the map.

topOverlayAtPoint

Returns the topmost overlay at a given point on the webpage.

Adding and Removing Tile Overlays

tileOverlays

An array of all of the map's tile overlays.

addTileOverlay

Adds a tile overlay to the map.

addTileOverlays

Adds an array of tile overlays to the map.

removeTileOverlay

Removes a tile overlay from the map.

removeTileOverlays

Removes an array of tile overlays from the map.

Displaying the User's Location

showsUserLocation

A Boolean value that determines whether to show the user's location on the map.

tracksUserLocation

A Boolean value that determines whether to center the map on the user's location.

userLocationAnnotation

An annotation that indicates the user's location on the map.

Converting Map Coordinates

convertCoordinateToPointOnPage

Converts a coordinate on the map to a point in the page's coordinate system.

convertPointOnPageToCoordinate

Converts a point in page coordinates to the corresponding map coordinate.

Destroying a Map

destroy

Removes the map's element from the DOM and releases internal references to this map to free up memory.

Accessing the Element

element

The map's DOM element.

Instance Properties

See Also

Maps

maps

An array to which maps are automatically added and removed as they are initialized and destroyed.