Customizing POI Behavior

Users of the cloud-based maps styling feature, have access to a set of features that control the behavior of points of interest (POIs) on the map.

POI filtering

Maps customization provides more granularity in the way points of interest can be filtered. Customers can filter business points of interest according to five subcategories:

  • Shopping
  • Food and Drink
  • Lodging
  • Car Rental
  • Gas station

For example, to show Shopping, Food and Drink, and Car Rental points of interest, open the Style Editor, select those subcategories, and then save the style.

Filter POIs

POI density control

You can also adjust the density of how points of interest are displayed on a map. Increasing the density displays more points of interest of the selected type. Decreasing the density displays fewer points of interest.

To adjust the density:

  1. Select Points of interest in the Style Editor to open the Element type pane.

    Adjust Density

  2. Move the slider at the top of the pane to the desired density. You should see the density of points of interest adjust on the map.

  3. Select Save to save the style.

Marker Collision Handling

You can use the Marker.CollisionBehavior property to specify whether custom markers should override default basemap labels when there is a collision, and to indicate relative priority between custom markers. Use one of the following values:

  • REQUIRED - Default. Indicates that the marker must be placed, and can be overlapped with other markers and labels.
  • REQUIRED_AND_HIDES_OPTIONAL - Indicates that the marker must be placed, and will hide any OPTIONAL_AND_HIDES_LOWER_PRIORITY markers, or labels that would overlap with the marker. It may be overlapped with other required markers.
  • OPTIONAL_AND_HIDES_LOWER_PRIORITY - Indicates that the marker may be replaced, or overlapped by a required marker, or replaced by an OPTIONAL_AND_HIDES_LOWER_PRIORITY marker with higher priority. Use zIndex to help determine relative priority between OptionalAndHidesLowerPriority markers (a higher zIndex value indicates higher priority).

The following code example shows setting CollisionBehavior for a new marker:

Java

Marker marker = map.addMarker(
    new MarkerOptions()
        .position(new LatLng(10, 10))
        .zIndex(10) // Optional.
        .collisionBehavior(Marker.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY));
      

Kotlin

val marker = map.addMarker(
    MarkerOptions()
        .position(LatLng(10.0, 10.0))
        .zIndex(10f) // Optional.
        .collisionBehavior(Marker.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY)
)