Reverse Geocoding help

407 views
Skip to first unread message

Mark

unread,
May 17, 2011, 11:29:03 AM5/17/11
to google...@googlegroups.com
New Google Refine user here, and I'm trying to reverse geocode a column with LAT,LONG values and create a new column with the address of the location. An example of a cell value would be: -33.9187213013,151.1708038707

I'm using the "Add column by fetching urls" tools, and my expression is: 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' + value + '&sensor=false&client=clientID&signature=<myAPIkey>' 

A column is returned, but it's always empty. If I 'test' the sample expression (with <value> replaced by an actual coordinate) in a browser window, the message "Unable to authenticate the supplied URL. Please check your client and signature parameters." is returned.

If I understand correctly, it appears as though I haven't generated a valid signature? Or is this whole process of reverse geocoding in Refine not even possible? Sorry, code junkie I am not - any help you can offer would be greatly appreciated.

Michael Tucker

unread,
May 17, 2011, 11:47:03 AM5/17/11
to google...@googlegroups.com
Hi Mark,

 I am not on expert on this stuff - but to double check a few things

* Are you entering the literal string "clientID" or are you replacing that with a particular ID?

* Have you tried accessing the same URL through your browser or in a custom web page to verify that it works properly outside of Refine?

Mike

Mark

unread,
May 17, 2011, 11:53:38 AM5/17/11
to google...@googlegroups.com
I'm not entering the literal string "ClientID", no. I have obtained an actual ID from the Google API console, but it's just the 'simple' one. I'm beginning to think that in order to get a signing key, I have to sign up for Google Maps API Premier at http://code.google.com/apis/maps/documentation/premier/

The only way I've tried checking if the url works is by pasting it into a new browser window & hitting go. That's when I get the error message of "Unable to authenticate the supplied URL. Please check your client and signature parameters."

Maybe I'm not understanding what you're asking though? I haven't embedded the code into a web page, no - though I could, I suppose. I just don't really know where to put the code...

Michael Tucker

unread,
May 17, 2011, 12:01:13 PM5/17/11
to google...@googlegroups.com
Looking at the documentation, it seems like the client and signature are no longer required. When I go to the following URL:


It works for me without the signature. Maybe try dropping those components from your URL and see if that fixes your issue.

Mike

Mark

unread,
May 17, 2011, 12:44:25 PM5/17/11
to google...@googlegroups.com
That seems to have done it Mike - I guess I was making it too complicated!

Now to start separating out all the data combined in that new column. :S

Thank you for your help!

Paul Makepeace

unread,
May 17, 2011, 12:46:14 PM5/17/11
to google...@googlegroups.com
Hi Mark,

This isn't an answer to your question, but... you might end up finding
working with the Google reverse geocoder and Refine a pain as its data
structure isn't particularly conducive in some ways to pulling out the
data.

Say you wanted to turn a lat,long into a nearest city name, you'll
have to iterate through its address_components and compare on types.
At least as far as I'm able with Refine, that's much more work than
say, parseJson(cells['address resources'].value)[0]['address']

Bing & Yahoo have a more Refine-friendly results structure, but you'll
have to sign up for an API key (about five minutes' work)

YMMV!

Paul

Mark

unread,
May 17, 2011, 1:03:26 PM5/17/11
to google...@googlegroups.com
Paul, I see what you mean that the Google geocoder's structure isn't what I would call logically organized. I think I may have to do a bit of brute-force cleanup on this, as code isn't my strong suit.


Paul Makepeace

unread,
May 17, 2011, 1:05:32 PM5/17/11
to google...@googlegroups.com
If you can wait until tomorrow I can present a worked solution using
Bing's API since I did this recently.

Tom Morris

unread,
May 17, 2011, 1:11:48 PM5/17/11
to google...@googlegroups.com
On Tue, May 17, 2011 at 12:46 PM, Paul Makepeace <pa...@paulm.com> wrote:

> This isn't an answer to your question, but... you might end up finding
> working with the Google reverse geocoder and Refine a pain as its data
> structure isn't particularly conducive in some ways to pulling out the
> data.

You probably also want to review the Terms of Service for the Google
Geocoder API, particularly the part about only using the results in
conjunction with displaying a location on a Google Map, and not saving
them.

Tom

Thad Guidry

unread,
May 17, 2011, 1:23:28 PM5/17/11
to google...@googlegroups.com
Tom brings a good point, and it's also the reason why I have not used the Geocoder API.
--
-Thad
http://www.freebase.com/view/en/thad_guidry

Mark

unread,
May 17, 2011, 1:54:43 PM5/17/11
to google...@googlegroups.com
Thanks for the heads up on the TOS. After reviewing it, it appears as though I've either got to abandon this project, or use another geocode service. :(

Priscila

unread,
Jun 10, 2016, 10:38:14 AM6/10/16
to OpenRefine, google...@googlegroups.com, pa...@paulm.com
Could you find out how to do it?

Priscila

unread,
Jun 10, 2016, 10:38:14 AM6/10/16
to OpenRefine, google...@googlegroups.com
But Mike, how about when you reach the daily limit?
That is they main reason to get an api key!

Ettore Rizza

unread,
Jun 10, 2016, 6:31:14 PM6/10/16
to OpenRefine, google...@googlegroups.com

I often use Google Maps API's in Open Refine without any problem (see screenshot). Have you tried with : "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + cells.lat.value + "," + cells.lon.value + "&key=YOURKEY" (assuming, of course, that your latitudes and longitudes are stored in colmuns named lat and lon) ?
Reply all
Reply to author
Forward
0 new messages