简体   繁体   中英

Geocoder gem in rails returning : over query limit

I have a model Events with geocoded_by :address and after_validation :geocode , I also have a google api key in my geocoder.rb (initializer) . The key is enabled for GeocodingAPi. When I run .geocode in console I have a limit error message.

2.5.3 :024 > Geocoder.coordinates("25 Main St, Cooperstown, NY")
Google API error: over query limit.

or

2.5.3 :030 > a.full_address
 => "80,  Rue des Capucins, Paris" 
2.5.3 :031 > a.geocode
Google API error: over query limit.
 => nil 
2.5.3 :032 > 

I have not used that API at all today, so I am sure this cannot be a limit issue. I am testing on localhost, so cannot be a shared server limit issue either. Anybody know what should be done/checked in such case ?

Geocoder.configure(
   lookup: :google,            
   ip_lookup: :ipinfo_io,      
   use_https: true,           
   api_key: nil,               
   cache: Redis.new,                 
  api_key: 'AIzaSXXXXXXXXXXXXXXXXXXXXXXXXXX'

)

Google Geolocation API is not free, it has limit. check the website gecoding usage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM