[ Whereis® API Home ] [ Developers' Guide ] [ Layers ]

A marker consists of an icon at some specified geographical position. Typically, it is used to represent a point of interest (POI).

Methods

The following methods are available for working with markers.

Name

Description

Map.addMarker(marker)

Adds the specified marker to the map

Map.clearMarkers()

Removes all markers from the map

Map.getMarkers()

Returns all the markers on the map. If no markers have been defined, returns an empty array.

Map.removeMarker(marker)

Removes the specified marker from the map

Marker.display(Boolean)

Shows or hides an existing marker.

 Assuming the point and icon have already been defined, the following snippet of code creates a marker and attaches it to the map. 

   

var marker = new EMS.Marker(point, icon);

    map.addMarker(marker);

NEXT PAGE

NOTES
Icon

A marker remains on the markers layer until it is explicitly removed, whether or not that location is currently within the map's bounding box.

If you pan or zoom the map so that the marker's location is temporarily out of view, the marker remains and reappears (provided that display is set to true) when you pan or zoom back to a bounding box that includes it.

Icon

For more information, see the JavaScript Command Reference and the following working example:

  • Map with marker