fractal5
fractal5

Reputation: 2142

Google Maps Geocoding API returning different address than Google Maps

I've been working on a project that requires me to get the address of a location from the name of the venue.

I'm doing this through Google's Geocoding API. However I see that sometimes, the wrong address and coordinates are returned. Searching for the location on Google returns the correct address.

eg: 'Queen Elizabeth Theatre - Toronto'

http://maps.google.com/maps/api/geocode/xml?address=Queen%20Elizabeth%20Theatre%20Toronto

What I would like is, '190 Princes' Blvd, Toronto, ON M6K 3C3', as per Google search.

This thread, Google Geocoding returning totally different result from Google Map, indicated that to get the right address I'd have to use Places API.

But for Places API to work I need to submit additional parameters other than just the name of the venue. Like approx. coordinates, and range of search, which I don't have (unless I get it with Geocoding API and then guess a search radius).

So what is the best way to get it?

Of course, I can scrape the page after searching for the location, but isn't scraping against Google's TOS?

Upvotes: 1

Views: 3105

Answers (1)

plexer
plexer

Reputation: 4622

The Geocoding API is intended to be used to translate addresses to geographic coordinates.

To find the location or address of a business or establishment (e.g. a theater), you should use the Google Places API. The Places API Text Search endpoint will allow you to query for the details of an establishment using only the name of that establishment. For example:

https://maps.googleapis.com/maps/api/place/textsearch/xml?query=Queen%20Elizabeth%20Theatre%20Toronto&key={yourkeyhere}

To use the API you will need an API key. See the Authentication section of this page for details on obtaining an API Key from the Google Developers console.

Upvotes: 2

Related Questions