我对基本问题道歉,我刚刚开始使用Geonames。
Ruby geokit gem包含以下使用Geonames的说明:
# To use this service either free or premium, you must register a key.
# See http://www.geonames.org
Geokit::Geocoders::GeonamesGeocoder.key = 'KEY'
我已在Geonames网站上注册,但我无法找到如何为自己生成API密钥。我查看了整个geonames网站,但找不到似乎这样做的页面。
一定有可能。有人可以向我解释一下吗?
答案 0 :(得分:0)
键是用户名。
对于那些希望注册和使用Geokit gem的人:
Geokit::Geocoders::GeonamesGeocoder.key = 'username'
。如果您使用的是Rails,则可以将该代码行添加到初始化程序中。Timezone宝石也很容易从通过Geokit检索的坐标中查找时区,并且还支持Geonames:
Timezone::Lookup.config(:geonames) do |c|
c.username = 'username'
end