Reputation: 63
I'm using Google-refine to download information from Google Maps. More specifically, I want the lat/long associated with a given address. I have successfully downloaded the XML information, but I'm having a horrible time parsing it. The typical entry looks like:
http://maps.googleapis.com/maps/api/geocode/xml?address=543+Boler+Rd,+London,+Ontario&sensor=false
My question is : How do i extract the lat (or long values) from this output using the language GREL.
Thanks in advance,
Carlos
Upvotes: 1
Views: 1070
Reputation: 10540
This is an old question which I apparently missed the first time around, but for the historical record, you could do something like:
value.parseHtml().select('location lat')[0].ownText().trim().toNumber()
The key insight is that the HTML parser can also be used to parse XML. The XML includes bounding box info as well as the (centroid?) point location, so be sure to make your selector expression specific enough to get the one that you want.
Upvotes: 4