Are apple maps and MapKit the same API?

When I do a search on Apple maps and one in my application using MapKit, I get two different results for "New York".

Are they both using the same api?

If I do a search for "New York" on the apple maps, it puts a pointer to downtown New York. But if I start searching for "New York" with MapKit using MKLocalSearchRequest

and naturalLanguageQuery

, it places the pointer a bit, not even Manhattan.

code:

override func viewDidLoad() {
        super.viewDidLoad()

        self.mapView.delegate = self


        localSearchRequest = MKLocalSearchRequest()
        localSearchRequest.naturalLanguageQuery = "New York"
        localSearch = MKLocalSearch(request: localSearchRequest)
        localSearch.startWithCompletionHandler { (localSearchResponse, error) -> Void in



            if localSearchResponse == nil || self.mapView == nil{
                var alert = UIAlertView(title: "Not found", message: "Try again", delegate: self, cancelButtonTitle: "OK")
                alert.show()
                return
            } else {

                let location = CLLocationCoordinate2D(latitude: localSearchResponse.boundingRegion.center.latitude, longitude:     localSearchResponse.boundingRegion.center.longitude)


                let span = MKCoordinateSpanMake(0.05, 0.05)
                let region = MKCoordinateRegion(center: location, span: span)
                self.mapView.setRegion(region, animated: false)


                self.pointAnnotation = MKPointAnnotation()
                self.pointAnnotation.coordinate = location
                self.mapView.addAnnotation(self.pointAnnotation)
            }


        }

    }

      

+3


source to share


1 answer


they don't use the same api for display, so I also assume they don't use the public API for search.

Especially considering the fact that the application appeared before the API

BUT, but probably besides the point



You do not set the area property: "Map area containing a hint about where to look." (at least this is not the same as in apple cards)

for me it only returns one result (using mapkit)

+1


source







All Articles