4

My apologies for the basic question, I am just starting to use Geonames.

The Ruby geokit gem contains the following instruction for using Geonames:

# To use this service either free or premium, you must register a key.
# See http://www.geonames.org
Geokit::Geocoders::GeonamesGeocoder.key = 'KEY'

I have registered on the Geonames site, but I cannot find out how to generate an API key for myself. I have looked all over the geonames web site but cannot find a page which appears to do this.

It must be possible somehow. Can someone explain this to me?

manngs
  • 41
  • 1
  • 3

2 Answers2

4

Just register for the free service from the geonames.org login page Geonames use the username parameter to count request already sent.

Since you have limited credit remember to setup request caching before going to production.

giosh94mhz
  • 2,908
  • 14
  • 25
2

The key is the username.

For those who are looking to register and use the Geokit gem:

  • Register to get a Geonames username (link)
  • Confirm your account from your email address.
  • Enable free web services in your account page (link)
  • Add your username to Geokit: Geokit::Geocoders::GeonamesGeocoder.key = 'username'. If you are using rails, you can add that line of code to an initializer.

The Timezone gem is also handy to lookup time zones from coordinates retrieved through Geokit, and it also supports Geonames:

Timezone::Lookup.config(:geonames) do |c|
  c.username = 'username'
end
aruanoc
  • 817
  • 1
  • 7
  • 9