Using Google Maps on iOS

Hi everyone,

I’m trying to develop an app right now and stuck at integrating the search function. I tried using the native map (Apple Maps) on iOS but it doesn’t seem to be finding some well-known locations in our hometown. I’m positive that those places can be found on Google Maps so I want to implement Google Maps for this part of the app.

I thought I can make my search in Google Maps, get the coordinates and pinpoint the location on Apple Maps but I don’t have an idea about how to do that. As I’ve tried one of the sample entries with the Google Maps Geocoding API, this approach failed because the API returns one of the other locations with the same name and doesn’t give me another chance.

I guess only thing I can do is integrating “Places Search Box” or “Place Autocomplete” from the Google Maps API. The user will search for the place they are looking for and the API pinpoints that and -hopefully- returns latitude, longitude data to me. (+ https://developers.google.com/maps/documentation/javascript/places-autocomplete#introduction)

At this point, I felt the need to ask for help because I’m not a good web developer and haven’t done anything like that with Corona SDK before. I need your help to find answers to those questions:

1- Is “Places Search Box” or “Place Autocomplete” the right way to do this? If not, what should I do?

2- As I mentioned before, I haven’t done something like this with Corona before so is there a way that I could integrate “Places Search Box” and the Javascript code into the app? If there’s a step by step tutorial -or a direct solution- on how to do that, that would be great.

I’m heavily relying on your answers. Hope you can show me the way. Thank you all in advance.

I have this Yelp plugin that may help.
https://github.com/scottrules44/yelpCorona
You could add a event listener to a text feild and make a search call every time the text box is edited and show auto complete with that. Play with the Json returned to you by the and place the lat and long on the map view.

Hello Scott,

Does the Yelp plugin you developed use Google Maps? Also, can I search for addresses with it like “X Street”? I also need that as well as searching shops etc.

Yelp has their own community/business based databases. Meaning if I did not see a restaurant or business I can add. The Yelp plugin can take lots of info including addresses and categories. You should look at the wiki in the Yelp github

Thank you for your help Scott but I went with Google Maps web services for this one.

Here is what I did for future reference:

1- I used Place Autocomplete from Places API Web Service to get search results, every time the user types in a character in the text field. Then, I encoded the JSON file for search results and placed them in the UI. In the meantime, I added code to associate place_id, which is found in the JSON file returned by the API, with users’ selection so that I can use it while searching for detailed information (latitude, longitude etc.) about the selected address.

2- Now, it was time to search for the place and pinpoint it on the map. I used Place Details from Places API Web Service and the place_id I stored before. After that, I only decoded the JSON file for latitude and longitude and showed it on the map.

Glad you found what works for you :slight_smile:

I have this Yelp plugin that may help.
https://github.com/scottrules44/yelpCorona
You could add a event listener to a text feild and make a search call every time the text box is edited and show auto complete with that. Play with the Json returned to you by the and place the lat and long on the map view.

Hello Scott,

Does the Yelp plugin you developed use Google Maps? Also, can I search for addresses with it like “X Street”? I also need that as well as searching shops etc.

Yelp has their own community/business based databases. Meaning if I did not see a restaurant or business I can add. The Yelp plugin can take lots of info including addresses and categories. You should look at the wiki in the Yelp github

Thank you for your help Scott but I went with Google Maps web services for this one.

Here is what I did for future reference:

1- I used Place Autocomplete from Places API Web Service to get search results, every time the user types in a character in the text field. Then, I encoded the JSON file for search results and placed them in the UI. In the meantime, I added code to associate place_id, which is found in the JSON file returned by the API, with users’ selection so that I can use it while searching for detailed information (latitude, longitude etc.) about the selected address.

2- Now, it was time to search for the place and pinpoint it on the map. I used Place Details from Places API Web Service and the place_id I stored before. After that, I only decoded the JSON file for latitude and longitude and showed it on the map.

Glad you found what works for you :slight_smile: