Geocoder is a complete geocoding solution for Ruby. With Rails it adds geocoding (by street or IP address), reverse geocoding (find street address based on given coordinates), and distance queries. It’s as simple as calling geocode on your objects, and then using a scope like Venue.near("Billings, MT").
Questions tagged [rails-geocoder]
397 questions
5
votes
0 answers
using rails geocoder when object has 2 sets of coordinates
Rails 3.1, Ruby 1.9.3
So I have two models, both have two sets of coordinates.
The first model, Load, has from_lat/lng, as well as to_lat/lng.
The second model, Trucks, has current_lat/lng as well as destination_lat/lng.
What I'm trying to do is…

Justin
- 61
- 4
5
votes
2 answers
Can Ruby Geocoder return just the street name on reverse_geocode calls?
The geocoder gem will automatically reverse geocode on save if the line after_validation :reverse_geocode is included in the model. This results in a long string of text being saved as the address, though - the format is something like "Street Name,…

James Chevalier
- 10,604
- 5
- 48
- 74
5
votes
2 answers
How do I setup geocoder with google_premier?
I've read the docs for the geocoder gem which state you can set a key, client and channel when using Google Premier.
According to some other posts I've read here, it's now possible to use an API key and still not pay as long as you're below the…

Simmo
- 1,717
- 19
- 37
4
votes
1 answer
Geocoder returns nil for ip-addresses?
I am working in ruby on rails. Rails version 3.1.1. I have been using Geocoder gem to geocode locations based on street addresses and it is working just fine. Now I have been trying to use my visitors ip-address to locate them.
I have tried
result =…

Albin
- 2,912
- 1
- 21
- 31
4
votes
2 answers
Ruby Geocoder gem to find postal code
I'm using the ruby geocoder gem to search by location. I want to limit searches to locations that have officially launched. If someone searches by zip, this is easy using a regex. But if someone searches by city, I need to convert the city into a…

Robert
- 543
- 2
- 6
- 17
4
votes
2 answers
Rails geocoder - Google Geocoding API error: over query limit - PRODUCTION ONLY
geocoder gem has stopped working solely in the production environment. It works perfect and as expected in development.
I am on Ubuntu 16.04 using ruby 2.3.1 and rails 4.2.6
When I run ModelName.near("zip_code", "radius") in development from the…

Ctpelnar1988
- 1,235
- 3
- 15
- 38
4
votes
0 answers
Walking route distance between two locations using Rails Geocoder
I am trying to get Walking route distance between two locations using Rails Geocoder, but it taking the latitude and longitude values and giving the distance between them which doesn't suit in my application. I need to get the distance between two…

verma
- 57
- 4
4
votes
0 answers
Geocoder returning empty array
I am creating a Rails application where I need to find the latitutes and longitutes of places using google maps service. I am using the geocoder gem for this purpose. Seems at times (i.e. for some geographical locations) the geocoder.search function…

Rahul Poddar
- 343
- 1
- 4
- 12
4
votes
2 answers
Geocoder request.location returns nil
I am using Geocoder gem to find current location. It was working fine before but now when i checked it returns nil for request.location.
request.location => nil

Aman Garg
- 4,198
- 2
- 21
- 29
4
votes
1 answer
Geocoder: How get all results and order by distance?
I know how to use the near method to get all results within a certain radius, but how do I get all results and order by distance?
I know I could do something like this:
Location.near(my_location, 999999, order: 'distance')
However, I would rather…

Godwin
- 9,739
- 6
- 40
- 58
4
votes
0 answers
How to generate random IP address of a specific country
I was wondering if there is a way to use GeoIP gem and generate a random IP-address of a specific country.
Something like GeopIP.random_ip('IN') should output '183.82.121.911'.
Any help.

Satya Kalluri
- 5,148
- 4
- 28
- 37
4
votes
1 answer
geocoder: distance sortable index
I'm developing a rails app where Users are having many Items. The users are geocoded thanks to another model I called Place that is relying on the ruby geocoder gem.
class Place < ActiveRecord::Base
attr_accessible :street_number, :street,…

microcosme
- 703
- 1
- 5
- 22
3
votes
2 answers
distance queries by coordinates in rails 3.x
I have a location object with latitude and longitude attributes and I want to query the database for objects within a specific distance from a current latitude / longitude location.
I read about the 'geocoder' gem which seems to be able to do what…

Gal Ben-Haim
- 17,433
- 22
- 78
- 131
3
votes
1 answer
Geocoder Gem Reverse Geocoding
After watching RailsCasts #273 I want to use the Geocoder gem. I've seen this:
class Skatepark < ActiveRecord::Base
reverse_geocoded_by :latitude, :longitude
after_validation :fetch_address
...
end
which will reverse geocode the coordinates…

Kyle Decot
- 20,715
- 39
- 142
- 263
3
votes
2 answers
Search via Geocoder gem with an existing google placeId for a location
I'm trying to search for a location, using an existing google PlaceId.
It is referenced in the documentation to pass the param:
google_place_id: true
require 'geocoder'
Geocoder.search("ChIJLU7jZClu5kcR4PcOOO6p3I0", params: {google_place_id:…

Sam Watson
- 31
- 3