Created
July 26, 2011 14:29
-
-
Save axeda/1106893 to your computer and use it in GitHub Desktop.
MobileLocation Object script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.net.http.RESTClient | |
String rmdHostname = "http://ws.geonames.org"; | |
if (mobileLocation != null) | |
{ | |
rmd = new RESTClient(rmdHostname); | |
try { | |
def resp = rmd.get( path: 'findNearestAddress', | |
query:[lat:mobileLocation.lat , lng:mobileLocation.lng] ) | |
streetnum = resp.data.address.streetNumber.text() | |
street = resp.data.address.street.text() | |
town = resp.data.address.adminName2.text() | |
state = resp.data.address.adminCode1.text() | |
postalcode = resp.data.address.postalcode.text() | |
return streetnum + " " + street + " " + town + " " + state + " " + postalcode | |
} catch (groovyx.net.http.HttpResponseException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment