0

I have read this post and it looks very promising. However, the answer does not go in detail with regards the implementation.

Basically, given the latitude and longitude, how can I use the GeoNames Web Service to get the country. I would like the returned result to be stored in a variable so that I can then continue working with it as I wish.

Thanks in advance

Community
  • 1
  • 1
Goaler444
  • 2,591
  • 6
  • 35
  • 53

1 Answers1

2

Do you have to use javascript for that? Geonames doesn't seem to offer a javascript api for doing your exact query (see here: http://www.geonames.org/export/JSON-webservices.html). And remote file fetching via javascript is not a joy.

If you could use php for that, it would be as easy as

$country = file_get_contents("http://ws.geonames.org/countryCode?lat=49.03&lng=10.2");
David Müller
  • 5,291
  • 2
  • 29
  • 33