New map styling is coming soon to Google Maps Platform. This update to map styling includes a new default color palette and improvements to map experiences and usability. All map styles will be automatically updated in March 2025. For more information on availability and how to opt in earlier, see New map style for Google Maps Platform.
GMSCollisionBehaviorRequired (Default): Always display the marker
regardless of collision. This is the default behavior. Has no impact on
whether any other markers or basemap labels show.
GMSCollisionBehaviorOptionalAndHidesLowerPriority: Display the marker only
if it does not overlap with other markers. If two markers of this type would
overlap, the one with the higher zIndex is shown. If they have the same
zIndex, the one with the lower vertical screen position is shown.
GMSCollisionBehaviorRequiredAndHidesOptional: Always display the marker
regardless of collision, and hide any
GMSCollisionBehaviorOptionalAndHidesLowerPriority. Display the marker only
if it does not overlap with other markers. Does not
GMSCollisionBehaviorRequired. If two markers of this type would overlap,
the one with the higher zIndex is shown. Collision rules for markers with
the same zIndex are undefined.
Swift
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map
marker.collisionBehavior = .requiredAndHidesOptional
Objective-C
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map
marker.collisionBehavior = GMSCollisionBehaviorRequiredAndHidesOptional