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

How to pulsing sprite until touch on the screen in cocos2d-x for android?

android cocos2d-x

I have used CCSequence, But i am not able to use CCRepeatForEver.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.