I have tried to implement Google's autocomplete API, when user types a location and presses to enter, A map with markers load in another page. It looks exactly like Airbnb. Search, then map..
My problem is, lately I am getting an error of "query size limit reached". I have read all the posts about this issue here but could not find a solution.
Basically, when user types an address as string, I get that string and use it for google maps' init lat & long. I use geocoder gem and server as Heroku.
Here is how it looks like;
@search = params[:search]
if !@search.nil? && @search.strip != ""
location = Geocoder.search(params[:search])
@initlat = location[0].latitude
@initlng = location[0].longitude
end
Why I am getting this error and how can I solve it?
https://developers.google.com/maps/documentation/geocoding/usage-limits
Users of the standard API:
2,500 free requests per day, calculated as the sum of client-side and server-side queries.
50 requests per second, calculated as the sum of client-side and server-side queries.
Paid use
Enable pay-as-you-go billing to unlock higher quotas:
$0.50 USD / 1000 additional requests, up to 100,000 daily.
ENABLE BILLING
just click on ENABLE BILLING button and get API key and set geocoder.rb
# config/initializers/geocoder.rb
Geocoder.configure(
# geocoding service (see below for supported options):
:lookup => :yandex,
# IP address geocoding service (see below for supported options):
:ip_lookup => :maxmind,
# to use an API key:
:api_key => "...",
# geocoding service request timeout, in seconds (default 3):
:timeout => 5,
# set default units to kilometers:
:units => :km,
# caching (see below for details):
:cache => Redis.new,
:cache_prefix => "..."
)