31839

Find all parks for a given zipcode with google maps

Question:

I'm trying to use the <a href="http://code.google.com/apis/maps/documentation/geocoding/" rel="nofollow">Google maps geocode API</a> to return all parks for a given zip code. It seems that if I have a park name I have no problem returning the data. Such as <a href="http://maps.googleapis.com/maps/api/geocode/json?address=Kerry+Park+98122&sensor=false" rel="nofollow">http://maps.googleapis.com/maps/api/geocode/json?address=Kerry+Park+98122&sensor=false</a>

However, if i search for parks for a zip code <a href="http://maps.googleapis.com/maps/api/geocode/json?address=Parks+near+98122&sensor=false" rel="nofollow">http://maps.googleapis.com/maps/api/geocode/json?address=Parks+near+98122&sensor=false</a>

I get any result for the zip code with parks in the address. I tried using lanlng but that has the same problem. It seems that Google doesn't allow types[] in query just the results which is unfortunate.

If I search for "parks near 98122" on <a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Parks%20Near%2098122&aq=&sll=47.616302,-122.353482&sspn=0.014378,0.038409&ie=UTF8&hq=Parks&hnear=Seattle,%20Washington%2098122&t=h&z=14" rel="nofollow">maps.google.com</a> I get all the results but it doesn't seem to be using the same API.

I requested a <a href="http://code.google.com/apis/maps/documentation/places/" rel="nofollow">Google maps Places api</a> key which I think is what I need.

I guess my questions are:<br /> a) am I missing something here?<br /> b) I'm not stuck with Google API are their others that will output JSON results for all parks by zip. I looked briefly into Bing and Yahoo to no avail.

Thanks.

Answer1:

The Google geocoder API doesn't have a provision for specifying a "type" such as "park" in the query. It will identify the feature type in the response, but you can't put it in the the request.

You might be able to do what you want in the Google Places API, now out for developer preview. I haven't tried it. You still can't specify a type in the request, but you specify a location and radius, and it returns all places, and each place has one or more associated type codes (which might include park). You can search through the returned results to see if parks appear. See <a href="http://code.google.com/apis/maps/documentation/places/" rel="nofollow">http://code.google.com/apis/maps/documentation/places/</a>

Answer2:

Use Google Places API and the text search.

Change the [zipcode] and the key [apikey]:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=park+in+[zipcode]&key=[apikey]

Recommend

  • How to check if a Map or Set is empty?
  • Amazon S3 Signed Url is not working with Office Web Apps Viewer (encodeURIComponent not working)
  • How to read Java property file in AngularJS?
  • Raphael setting transparent png opacity loses alpha channel
  • Can python read the value of a cell in a spreadsheet?
  • Created a new view in MVC 5, opening the new view results in HTTP 404
  • Java: Read certificates from windows store
  • IntelliJ does not find native libraries for OpenCV when adding jar as a dependency for Play project
  • android graph-view y axis numbers being cut out
  • How to exclude NULLs from ARRAY so query won't fail
  • How do I delete blank panels from eclipse?
  • SignalR performance
  • Pycharm Django Debugging is really slow
  • ObservableCollection loses binding when I “new” it
  • Unable to read FNC1 character at the first position of a GS1 128 Barcode using Zbar library?
  • Adding 1 hours to time stamp columns in Pyspark data frame
  • Mongoose query to exclude a value from the result
  • Cannot modify mapred.job.name at runtime. It is not in list of params that are allowed to be modifie
  • How does RabbitMQ supports large number of virtual connections from a single TCP connection?
  • Javascript matrix inversion
  • Solid gradients not really solid? Don't have crisp edges at color stops
  • Running ASP.NET Web Api 2 application without Visual Studio
  • Excel VBA: Forward ParamArray to Application.Run
  • Why context.Wait in StartAsync didn't stop the dialog
  • How to delete first 7 characters of folder name by using batch script?
  • In metro, get all inherited classes of an (abstract) class?
  • Django REST framework - HyperlinkedRelatedField with additional parameter
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • Runtime complexity of getting the length of a string in different representations
  • Ruby regex for matching simpliest Ruby's regexes
  • PHPMailer return to AJAX
  • Why is ordered choice in pyparsing failing for my use case?
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • Google App Engine Datastore: Dealing with eventual consistency
  • How to get rgb from transparent pixel in js
  • Computing the discrete fourier transform of audio data with FFTW