Geonames Ruby API

The Geonames graphical database contains over eight million geographical names and consists of 6.3 million unique features whereof 2.2 million populated places and 1.8 million alternate names. It was created by Marc Wick, a software engineer in Switzerland. He has released it under a Creative Commons license and was nice enough to provide a freely available Web Service to integrate it into your applications.

The Geonames web service has proven itself very useful to me for the development of Carpool Connect. I’m currently using it to reverse geocode longitude and latitude coordinates and plan on using other features of it in the future.

I’ve put together a ruby library for accessing the Geonames Web service and released it under the Apache Open Source license. You can find more information about it on the project page.

To insatall:

# gem install geonames

Example Usage:

require 'geonames'places_nearby = Geonames::WebService.find_nearby_place_name 43.900120387, -78.882869834p places_nearbycountry_subdivision = Geonames::WebService.country_subdivision 43.900120387, -78.882869834p country_subdivision

2 thoughts on “Geonames Ruby API

  1. Sjors Provoost

    Great tool! I am currently checking a database with about 180.000 ringed and recaptured ducks for consistency. The database goes all the way back to 1935 so there are lots of problems with it. The coordinates do not always match the country they are supposed to match. E.g. many ducks were found in the former Soviet Union, so I redetermine their country using the reverse geocoding. This tools makes that a bit easier. I hope I am not over-ballasting the geonames.org server though. I also filed a bug report at Google Code, because the country_subdivision part is not working (for me). If you can fix that, I can get to the next challenge: fix all the country subdivision information, which is an even bigger problem.Cheers,Sjors

Leave a Reply