Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Google Maps Search Bar

I'm making an iPhone location based app and I'm having trouble with the last aspect of it. I was wondering if anyone knows how to integrate a search bar that correlates with the map that we can use from MKMapView.

It's literally a search bar above the map that the user can type in an area and it will take them there.

Is this possible?

I've looked around for tutorials but I have only found how to make an app with a map view, annotations and adding callouts.

like image 324
user1977908 Avatar asked Feb 04 '13 17:02

user1977908


1 Answers

What you're looking for is geocoding - the process of turning an address in your search bar into a latitude/longitude coordinate, which you can then set the map's position to.

This question has two main answers. This answer shows how to geocode using a Google API, and this answer shows how to geocode using an Apple API.

If you're using MapKit (which uses Apple maps as of iOS 6.0), then you should probably use the Apple API (you are not supposed to use Google Maps APIs with non-Google maps).

If you're using the new Google Maps SDK for iOS, you might want to use the Google API for geocoding. Although note that the answer I've linked to is using the Google API with MapKit (as it was written back when MapKit was using Google Maps), so you would need to modify it a bit.

like image 182
Saxon Druce Avatar answered Sep 26 '22 23:09

Saxon Druce