1

I'm trying to debug a "too many queries" error I'm getting in my rails app. It appears that the rate limit is being surpassed. I'm trying to locate where the app is providing a Google Geocoding service API key but I don't see it anywhere. I understand that you can optionally create a geokit config file in config/initializers/geokit_config.rb and provide an API key there. However, this project has no such geokit config file.

Does the geokit library use a default Google Geocoding service API key that is hardcoded in the library if there is no geokit_config.rb file present in the app? Stated another way, is it completely optional to provide a Google geocoding API key to use the geokit library with its included google geocoding service functionality?

Thanks for any help.

Murcielago
  • 1,030
  • 1
  • 14
  • 24

1 Answers1

2

I'm the maintainer of geokit. Yes, you can use it without a key, though I personally feel it would be unwise to do so in production.

But it is nice for "trying" the gem, though you'll hit your limit very quickly (you might even get that error straight away depending on how google limit, e.g. by IP)

See the README to easily set this:

# See https://developers.google.com/maps/documentation/geocoding/#api_key
Geokit::Geocoders::GoogleGeocoder.api_key = ''
Michael Noack
  • 356
  • 1
  • 5
  • 1
    Thanks. Just to clarify, these config settings belong in `/config/initializers/geokit_config.rb` in a rails app, correct? – Murcielago Apr 30 '18 at 16:05
  • That's the "rails way" and a best practice. But Geokit doesn't demand they be defined there, so long as the ruby code is called at some point. – Michael Noack May 31 '18 at 14:17
  • 1
    Is it still the case that you don't need an API Key to use the gem? I am trying to use console commands from here: https://github.com/geokit/geokit-rails#how-to-geocode-an-address and getting the error `An error has occurred during geocoding: You must use an API key to authenticate each request to Google Maps Platform APIs.` – Mark Locklear Feb 18 '19 at 16:13
  • The post says that you could get the error right away depending on how Google wants to limit it. That error is also not part of that codebase, so it probably comes from Google. When I get it, it references http://g.co/dev/maps-no-account, which is no longer a valid URL. Google probably stopped permitting unauthenticated access. – Allison Oct 21 '21 at 16:01