How can I use Google Maps API to search both places and postcodes?

I've been using the Google Maps Places API to do search a map for the iPhone, like in the Maps app itself. I use a line like this:

https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&rankby=distance&name=%@&sensor=true&key=%@

using NSString to enter the missing information. However, unlike the Maps app, this search only works for local places and not for postcodes or other information. It would appear that if I want it to accept postcodes, I have to create a geocode request:

https://maps.googleapis.com/maps/api/geocode/json?address=W1A+1AA&sensor=true

But then of course, this doesn't search place information. Like the Maps app, I want my app to seamlessly return the best results of both.

Before I go ahead and code it so that it uses two separate APIs, is there a better way of doing this? Should I be using a different API that works more like the search in the Maps app?

Answers


I've looked into this for something like looking into a specific service, let's say sushi, at a zip code for those who don't want to use location services. Unfortunately, it seems like you have to make two calls, one for geocoding and the other through Google Places to get the locations that are within the radius of the coordinates given in the geocoding call.

See: Find all parks for a given zipcode with google maps

and

https://groups.google.com/forum/?fromgroups#!msg/google-places-api/P3iDK5kO7OM/Cek4BzeXMA4J


Need Your Help

android XML parsers don't parse the complete link

android xml-parsing

So, I've been working on parsing a XML file getting from the internet (RSS).

Count unique values in each column of pipe delimited text file using Perl

python perl unix solaris-10

I have two sample pipe delimited file in my Solaris server home directory as below: