Obtain address from Lon/Lat coordinates

Can someone help on how I can get the address (item Text) which is located at or closest to a given longitude/latitude set of coordinates?
Any help would be much appreciated!

Google offers a reverse Geocoding API which you might be able to call with the HTTP binding or actions. Something like:


Location myLocation
String myAddress


rule LookupAddress
  Item myLocation changed
  val String url = "http://maps.googleapis.com/maps/api/geocode/json?latLng=" + myLocation.state.toString + "&key=" + YOUR_API_KEY
  val String results = sendHttpGetRequest(url)
  val String address = transform("JSONPATH", "$.results[0].formatted_address", results)

One note about this approach is that you might exceed your API limits if you have frequent changes to the myLocation item.

Great thanks!
I’m gonna give it a try.

how to use this with OPENHAB 3?