Is there any Apple API like google Place Search API?
Asked Answered
P

3

12

In my iPhone App I am using MKMapKit. Currently I am plotting places on map according to the results get from Google Place API, but as per Google's doc I must use this values only in google Maps. Unfortunately from iOS 6, MKMapKit will go to Apple Map itself.

Is there any Apple API like google Place Search API?

Now I am using URLs like this:

https://maps.googleapis.com/maps/api/place/search/json?location=10.0036830,74.318723&rankby=distance&types=restaurant&sensor=false&key="my API Key"
Protoplast answered 27/3, 2013 at 6:22 Comment(0)
Z
8

I believe this is what you're looking for? iOS Developer Library: MKLocalSearchRequest Class Reference

Zygo answered 27/3, 2013 at 10:30 Comment(5)
Do you know if we have something like that from Apple but without using Maps? (my app only shows the closest restaurant information without using a map). Thanks a lot :)Stringency
Something like this? #23035027Zygo
Do you know if there is an Apple Maps API that I can use to search for the closest university (for example) to a point coordinates? (like the Azure Maps API).Sardis
@JaiGovindani do you know if this API is also usable on the web or in a server environment? I see only swift in the documentation.Phyte
@Thomas developer.apple.com/documentation/mapkitjsZygo
B
1

You can achieve this through MKLocalSearchRequest and MapKit.

It is showing autocomplete places just like google places API and can place the Annotation point on Apple's map (not on Google map, I hope that is only you are looking for.)

You can download a sample project from here, using MKLocalSearchRequest for fetching Places and showing in a auto complete tableview controller.

enter image description here

enter image description here

However it does not show as accurate result as you can get from Google Places API. As the problem is that Geocoding database is not obviously complete and Apple is not the company who leads this field - Google is.

Brittani answered 6/3, 2018 at 12:58 Comment(0)
B
0

Also if you use mapkit, you can use search api

mapkit.init({
      authorizationCallback: function (done) {
        done("<your-token>");
      },
    });

    // Create a new map
    var map = new mapkit.Map("map");
    console.log(map);
    var search = new mapkit.Search({
      region: map.region, // Optionally, specify the search region based on the map's current view
      getsUserLocation: true,
    });

    search.search("İstanbul Pendik", function (error, data) { // location which you want to search
      if (error) {
        console.error("Search error: ", error);
        return;
      }

      console.log(data);

      // Loop through results
      data.places.forEach(function (place) {
        console.log(place.name, place.phoneNumber, place.coordinate);
      });
    });
Bitumen answered 4/9, 2024 at 20:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.