This page shows you how to manage collisions between markers that you add to your map and default labels, such as points of interest (POIs) or street names.
Before you begin
To manage marker and label collisions, you must be using a map id enabled with vector image type.
Specifying marker priorities
Use the MarkerOptions
.collisionBehavior
property to specify priority on a
marker.
Use one of the following values:
REQUIRED
- Default. Requires display of a marker that overlaps with other markers, labels, and POIs.OPTIONAL_AND_HIDES_LOWER_PRIORITY
- Indicates that the marker may be replaced or overlapped by a required marker, or replaced by anOPTIONAL_AND_HIDES_LOWER_PRIORITY
marker with higher priority. UsezIndex
to help determine relative priority betweenOPTIONAL_AND_HIDES_LOWER_PRIORITY
markers. A higherzIndex
value indicates higher priority.REQUIRED_AND_HIDES_OPTIONAL
- Requires display of a marker while hiding anyOPTIONAL_AND_HIDES_LOWER_PRIORITY
markers, labels, or POIs that overlap with the marker. The marker may overlap with other required markers.
For more information, see the Marker Collision Management code sample.