I am writing a simple Android app with an EditText and a MapView. I want to be able to type “pizza near austin, tx”, and have the map zoom to pizza places in Austin, TX. I am using the Google API Java Client to send a request to Google Places API, and populate the results as overlays on the map. This is working sort of well, except that the Google Places API requires me to provide a longitude and latitude as part of the search request.
This API seems ideal for finding places near a user’s current location. However, if I am in NYC, and I want to see pizza places near Austin, TX, I would first have to parse the search string, map a location-looking part of the string to a longitude and latitude, and then run the query against Google Places API.
I wouldn’t mind doing this, if I were sure that there weren’t a better way to do it. Is there? It seems like a nut that Google has already cracked. Essentially, what I am looking for is Google Places API which will determine the latitude and longitude from the provided keyword (“pizza near austin, tx”).
Currently, the Places API does not support the use case you are describing. So, yes, the only way to do this right now is to perform a geocoding request for “Austin, TX”, then supplying the resulting LatLng in your Places Search request, using “pizza” as the argument. Also, you will have to derive the argument from the viewport returned by the Geocoding API.