You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Rails 5 application needs to offer to users different pages according to the country of the users. I would also need geocoding in controllers. I wonder how can I get the country with geokit-rails: would the following code be correct?
country = IpGeocoder.geocode(request.remote_ip).country
Also: is there any maximum quota that the below quota has to respect?
I do not understand if geokit-rails relies on external geocoding services like google, bind or maxmind.
The text was updated successfully, but these errors were encountered:
If you want to do this yourself (as your code sample is doing), you don't need the geokit-rails gem, the code could be done with just the geokit gem by itself.
Like @mnoack said, @knzudgt The geokit-rails gem is best used for adding geolocation features to your models. For example, if you have a "User" model, the user could have a lat and lng and you can find users that are near each other by calling something like User.by_distance(origin: @some_user)
If you just want plain 'ol geocoding features not specifically integrated in your models, you should just use the geokit gem, which is different from this geokit-rails gem.
As far as external services, any geocoding solution will require a third-party service unless it comes with download files. There are some services that offer free ip_address to country mappings that you can download and reference.
What CAN be done with geokit-rails without a third party solution is searching for records by distance using latitude and longitude values you've already saved in your database.
My Rails 5 application needs to offer to users different pages according to the country of the users. I would also need geocoding in controllers. I wonder how can I get the country with
geokit-rails
: would the following code be correct?Also: is there any maximum quota that the below quota has to respect?
I do not understand if
geokit-rails
relies on external geocoding services likegoogle
,bind
ormaxmind
.The text was updated successfully, but these errors were encountered: