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.
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]))
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With