MapIcon Class

Note

Bing Maps SDK for Android and iOS retirement

Bing Maps SDK for Android and iOS is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2025. Enterprise account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps SDK for Android and iOS will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

Displays a graphical image and optional text on the Map.

See Icons for more details on capabilities of the MapIcon class.

Android

class MapIcon extends MapElement

iOS

@interface MSMapIcon : MSMapElement

Properties

DesiredCollisionBehavior

Specifies the behavior of the icon when it collides with other map features due to zoom level.
The default value is MapElementCollisionBehavior.REMAIN_VISIBLE.

See also: MapElementCollisionBehavior

Android

MapElementCollisionBehavior getDesiredCollisionBehavior()
void setDesiredCollisionBehavior(MapElementCollisionBehavior behavior)

iOS

@property (nonatomic) MSMapElementCollisionBehavior desiredCollisionBehavior

Flat

Determines whether the icon should appear to lie parallel and flat to the earth, versus standing up and facing the user. The default is false.

Android

boolean isFlat()
void setFlat(boolean isFlat)

iOS

@property (nonatomic) BOOL flat

Flyout

Specifies the flyout associated with this icon.

See also: MapFlyout

Android

@Nullable MapFlyout getFlyout()
void setFlyout(@Nullable MapFlyout flyout)

iOS

@property (nonatomic, nullable) MSMapFlyout *flyout

Image

Specifies the image associated with this icon.

See also: MapImage

Android

@Nullable MapImage getImage()
void setImage(@Nullable MapImage image)

iOS

@property (nullable, nonatomic) MSMapImage *image

Passing null/nil will reset the icon to use the default image.

Location

Specifies the location of the icon.

See also: MSGeopoint

Android

Geopoint getLocation()
void setLocation(Geopoint location)

iOS

@property (nonatomic) MSGeopoint *location

NormalizedAnchorPoint

Specifies the anchor point for the icon. The anchor point is the point on the icon that is positioned at the geographic location specified by Location property. For example, for a pin icon this generally will be the tip of the pin.
(0, 0) represents the upper left corner of the graphical image, while (1, 1) represents its bottom right corner. The default value is (0.5, 0.5).

See also: Anchoring MapIcons

Android

android.graphics.PointF getNormalizedAnchorPoint()
void setNormalizedAnchorPoint(android.graphics.PointF point)

iOS

@property (nonatomic) CGPoint normalizedAnchorPoint

Opacity

Specifies the opacity of the rendered icon, in addition to any transparency defined in the image.
1 means completely opaque, and 0 means completely transparent. The default value is 1.

Android

float getOpacity()
void setOpacity(float opacity)

iOS

@property (nonatomic) float opacity

Rotation

Specifies the rotation in degrees of the icon around the anchor point clockwise. Values greater than 360 or less than 0 are accepted. The default is 0 (no rotation).

Android

float getRotation()
void setRotation(float)

iOS

@property (nonatomic) float rotation

Title

Specifies the text to be displayed alongside the icon.

Android

String getTitle()
void setTitle(String title)

iOS

@property (nonatomic) NSString *title

See Also