Pushpin Class


Pushpins, sometimes also referred to as markers or MapIcons on other mapping platforms, are one of the primary ways of marking a location on a map. The Pushpin class derives from the IPrimitive interface.

Note: When an array of pushpins are added to the map or a layer, the first pushpin is rendered last. The idea being that if the array contained search results, the first/most relevant result would be rendered on top rather than being covered by other nearby pushpins. This is a fundamental change made to improve the user experience from how previous versions of Bing Maps rendered pushpins.

Pushpin(location: Location, options?: PushpinOptions)

The Pushpin class has the following methods.

NameReturn TypeDescription
getAnchor()PointReturns the point on the pushpin icon which is anchored to the pushpin location. An anchor of (0,0) is the top left corner of the icon.
getClickedStyleEnabled()booleanReturns whether the pushpin clicked style is enabled.
getColor()string or ColorReturns the color option of the pushpin.
getCursor()stringGets the css cursor value when the pushpin has mouse events on it.
getDraggable()booleanReturns a boolean indicating if the pushpin is draggable or not.
getHoverStyleEnabled()booleanReturns whether the default pushpin hover style is enabled.
getIcon()stringReturns the pushpin icon path.
getLocation()LocationReturns the location of the pushpin.
getRoundClickableArea()booleanReturns whether the clickable area of the pushpin is an ellipse.
getText()stringReturns the text associated with the pushpin.
getTextOffset()PointReturns the amount the text is shifted from the pushpin icon.
getTitle()stringReturns the title label of the Pushpin.
getSubTitle()stringReturns the subtitle label of the Pushpin.
getVisible()booleanReturns a boolean indicating whether the pushpin is visible or not. A value of false indicates that the pushpin is hidden, although it is still an entity on the map.
setLocation(loc: Location)Sets the location of the pushpin.
setOptions(opt: PushpinOptions)Sets options for the pushpin.
metadataobjectInformation that is linked to the pushpin. Some modules such as the GeoJSON, and Spatial Data Service modules will also often add information to this property.
changedIPrimitiveChangedEventArgsOccurs when the location or options of the pushpin has changed.
clickMouseEventArgsOccurs when the mouse is used to click the pushpin.
dblclickMouseEventArgsOccurs when the mouse is used to double click the pushpin.
dragMouseEventArgsOccurs when the pushpin is being dragged.
dragendMouseEventArgsOccurs when the pushpin stops being dragged.
dragstartMouseEventArgsOccurs when the pushpin starts being dragged.
mousedownMouseEventArgsOccurs when the left mouse button is pressed when the mouse is over the pushpin.
mouseoutMouseEventArgsOccurs when the mouse cursor moves out of the area covered by the pushpin.
mouseoverMouseEventArgsOccurs when the mouse is over the pushpin.
mouseupMouseEventArgsOccurs when the left mouse button is lifted up when the mouse is over the pushpin.