Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove only restaurants from MKMapView

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

like image 821
Wesley Smith Avatar asked Dec 19 '22 15:12

Wesley Smith


2 Answers

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]))
like image 101
tk97tk Avatar answered Mar 06 '23 22:03

tk97tk


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.

like image 36
jszumski Avatar answered Mar 07 '23 00:03

jszumski