data data data
You can set proxys and caching here
rails generate geocoder:config
Bulk update
rake geocode:all CLASS=Transaction SLEEP=0.25 BATCH=100
Neat example: reverse geocoding to get location of phone
reverse_geocoded_by :latitude, :longitude do |obj,results|
if geo = results.first
obj.city = geo.city
obj.zipcode = geo.postal_code
obj.country = geo.country_code
end
end
after_validation :reverse_geoc
Get within a box
sw_corner = [40.71, 100.23]
ne_corner = [36.12, 88.65]
Venue.within_bounding_box(sw_corner, ne_corner)
we used searchkick to quey into our elastic search instance: (don't forget to increase ram for docker in mac)
docker-compose up
to index:
Model.reindex
# and it does the work
searchkick really does more than a simple client for elastic search, it makes query easy.
Chris GoRails videos :: Geocoding, Geolocation and Search with Geocoder + Google Maps APIs How to use Google Maps and Markers
Hey there ! I'm always ready to help ! Email me |