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.
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:
- Food and Drink
- 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.
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:
Select Points of interest in the Style Editor to open the Element type pane.
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.
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 overlap other markers and labels.
RequiredAndHidesOptional: Indicates that the marker must be placed, and will hide any
OptionalAndHidesLowerPrioritymarkers, or labels that would overlap with the marker. It may be overlapped with other required markers.
OptionalAndHidesLowerPriority: Indicates that the marker may be replaced, or overlapped by a
Requiredmarker, or replaced by an
OptionalAndHidesLowerPrioritymarker with higher priority. Use
zIndexto help determine relative priority between
OptionalAndHidesLowerPrioritymarkers (a higher
zIndexvalue indicates higher priority).
The following code example shows setting
collisionBehavior for a new marker:
let position = CLLocationCoordinate2D(latitude: 47.0169, longitude: -122.336471) let marker = GMSMarker(position: position) marker.zIndex = 10 marker.collisionBehavior = GMSCollisionBehavior.optionalAndHidesLowerPriority marker.map = mapView
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(47.0169, -122.336471); GMSMarker *marker = [GMSMarker markerWithPosition:position]; marker.zIndex = 10; marker.collisionBehavior = GMSCollisionBehaviorOptionalAndHidesLowerPriority; marker.map = mapView;