Help with geotag function
Hi folks,
I'm trying to write a function I could invoke through a custom action to geotag my contacts. The idea is to pass the full address of the contact at the end of this URL:
http://maps.google.com/geo?output=xml&q=
The result from Google is returned as XML, so I want to grab the "point" returned by Google and write it to a string field called "Point" in the contact's record.
Here's what I have so far:
void display.geotag(int id)
{
contact = Contacts [ID == input.id];
gMap = getUrl("'http://maps.google.com/geo?output=xml&q=' + contact.Full_Address",false);
stringData = gMap.get("responseText");
point = stringData.executeXPath("/:kml/:Response/:Placemark/:Point/:coordinates/text()");
contact.point = point;
}
You probably won't be surprised to know this isn't working :-) My problem is I'm not even really sure how to troubleshoot it -- how can I see what's being returned by Google's server so I can tell if the getUrl part is working? And if anyone has any other advice about what's wrong with this I'd love to hear it. Thank you!