Skip to main content
Version: 6.0

Annotations

Using Mappedin SDK for Android with your own map requires a Pro license. Try a demo map for free or refer to the Pricing page for more information.

Map annotations add visual or textual elements to maps, providing extra information about specific locations or features. Map makers can choose from many annotations included in Mappedin Maker to add to a map and access them using Mappedin SDKs.

tip

A complete example demonstrating Annotations with icons can be found in the Mappedin Android Github repo: MarkersDemoActivity.kt

Annotations are organized into the following groups. These are just a few examples of annotations, each group contains many more.

Annotation GroupExamples
Access FeaturesKeybox, roof access
Building SidesAlpha, bravo, charlie, delta
Equipment RoomsBoiler Room, Sprinkler control room
Fire RatingsFire and smoke wall 1 hour, firewall 3 hours
Fire SafetyFire Blanket, Fire Hose Reel
General SystemsEmergency Generator, Smoke Control Panel
HazardsBiohazard, Explosive
SafetyAccessible Elevator, Eyewash Station
Utility ShutoffGas Valve, Main Water Valve
VentilationChimney, Exhaust Fan
Water ConnectionsSprinkler FDC, Public Hydrant
Water SystemsFire Pump, Pressurized Water Tank

Incorporating annotations help provide a safer space for all. It allows users to easily locate key elements in the map.

Mappedin v6 Annotations

Using Annotations

An app may choose to display all annotations, annotations of a specific group or no annotations at all. The following code sample logs the name of each annotation.

mapView.mapData.getByType<Annotation>(com.mappedin.models.MapDataType.ANNOTATION) { r ->
r.onSuccess { annotations ->
// Add markers for all annotations that have icons.
annotations.forEach { annotation ->
Log.d("Annotation", annotation.name)
}
}
}

Annotation Icons

Mappedin provides a set of icons to represent annotations. The example below demonstrates using these icons and placing them as Markers on the map. Annotation.icon.url contains the URL of the icon to use.

tip

A complete example demonstrating Annotations with icons can be found in the Mappedin Android Github repo: MarkersDemoActivity.kt

mapView.mapData.getByType<Annotation>(com.mappedin.models.MapDataType.ANNOTATION) { r ->
r.onSuccess { annotations ->
val opts =
AddMarkerOptions(
interactive = AddMarkerOptions.Interactive.True,
placement = AddMarkerOptions.Placement.Single(MarkerPlacement.CENTER),
rank = AddMarkerOptions.Rank.Tier(CollisionRankingTier.HIGH),
)

// Add markers for all annotations that have icons.
annotations.forEach { annotation ->
val iconUrl = annotation.icon?.url
val markerHtml =
"""
<div class='mappedin-annotation-marker'>
<div style='width: 30px; height: 30px'>
<img src='$iconUrl' alt='${annotation.name}' width='30' height='30' />
</div>
</div>
""".trimIndent()
mapView.markers.add(annotation, markerHtml, opts) { }
}

// Remove markers that are clicked on.
mapView.on("click") { payload ->
val click = payload as? ClickPayload
val clickedMarker = click?.markers?.firstOrNull() ?: return@on
mapView.markers.remove(clickedMarker) { }
}
}
}