Question

I'd like my MKMapView to show points of interest except restaurants. Is this possible, and if yes, how can I set this up?

I did see the below in the Documentation but is it really all or nothing?

@property (nonatomic) BOOL showsPointsOfInterest;

When this property is set to YES, the map displays icons and labels for restaurants, schools, and other relevant points of interest. The default value of this property is YES.

For example, in the below, I want the gas station to show but not the restaurant.

enter image description here

Was it helpful?

Solution 2

It's not possible to control the specific type of points that are plotted. Apple could add/remove/change the specific types it displays in any future update of Map Kit. As you mentioned, your only course of action is setting showsPointsOfInterest.

You could use a third-party place database from Foursquare or Facebook to get similar points of interest and plot them on your map, however there is no guarantee that the results would match the ones Apple would otherwise show.

OTHER TIPS

With IOS 13 you have the option to filter: here a example to show no items on the map

localMap.pointOfInterestFilter = .some(MKPointOfInterestFilter(including: []))

For example you can filter airports out of the map...

localMap.pointOfInterestFilter = .some(MKPointOfInterestFilter(including: [MKPointOfInterestCategory.airport]))

Another option in iOS 13 is to include or exclude certain points of interest:

// Includes airports
localMap.pointOfInterestFilter?.includes(MKPointOfInterestCategory.airport)


// Excludes laundry/laundromats
localMap.pointOfInterestFilter?.excludes(MKPointOfInterestCategory.laundry)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top