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
17
votes
7 answers
Does Geocoder gem work with google API key?
I am using ruby geocoder gem for my project and as the project is growing I am starting to look into connecting to the Google API key. After adding this to the project:
Geocoder.configure do |config|
# geocoding service (see below for supported…

user527662
- 363
- 5
- 14
11
votes
4 answers
Using the geocoder gem for rails, how do i get the visitor's city?
https://github.com/alexreisner/geocoder
I can't find documentation to show the visitor's city from ip address? I know how to with HTML5, but I would like to use the value geocoder has. Thanks

kinet
- 1,790
- 3
- 20
- 32
9
votes
2 answers
Rails Geocoder Testing with rspec
I am trying to set up my RSpec tests to use stubs rather then using networking to do the geocoding.
I added this:
before(:each) do
Geocoder.configure(:lookup => :test)
Geocoder::Lookup::Test.add_stub(
"Los Angeles, CA", [{
…

templeman15
- 799
- 8
- 14
9
votes
4 answers
Testing with geocoder gem
I'm using the geocoder gem, but I don't know in which file I must paste this code. Can you tell me ?

Flo Rahl
- 1,044
- 1
- 16
- 33
9
votes
1 answer
Using geocoder on a child association, how to find all parents in a given location?
class User < AR
has_many :locations
end
class Location < AR
belongs_to :user
geocoded_by :address
end
How do I write a query that does this?
@users = User._a_query_that_returns_users_in_'Paris'_

Gavin
- 4,273
- 3
- 27
- 39
8
votes
3 answers
Geocoder distance method doesn't exist
I'm using the geocoder gem for Ruby that Ryan Bates introduces in episode 273 http://railscasts.com/episodes/273-geocoder?view=asciicast. In that episode, he uses the following to search objects within a 50 km radius (although he uses a Location…

Leahcim
- 40,649
- 59
- 195
- 334
8
votes
2 answers
How do I order the results of rails geocoder gem by something other than distance
I have this excellent gem https://github.com/alexreisner/geocoder working fine in my app but I need to order the results of an active record query slightly differently.
For example using the rails console
$> Person.near('London',10)
produces a…

32423hjh32423
- 3,048
- 7
- 44
- 59
7
votes
1 answer
Using Meta Search or Ransack with Geocoder
I've created a form that supplies search criteria:
= search_form_for @q do |f|
%h3
Search:
= f.label :category_id
%br
= f.collection_select :category_id_eq, Category.all, :id, :name, :include_blank => true
%br
= f.label…

user970203
- 91
- 2
6
votes
1 answer
Disable Geocode in Test environment
In my Ruby on Rails application I'm using Geocoder. It works fine, but my tests are ten times slower! I found some solution but in my opinion they are not very clear? Is there any way to disable Geocoder on test environment?

Mateusz Urbański
- 7,352
- 15
- 68
- 133
6
votes
5 answers
Geocoder rails, check if valid
Below is my class that I am using geocoder with. I am having trouble checking whether or not address that is put through geocoder is valid. This code works great when I am adding a company/editing a company that has addresses that when put through…

Scalahansolo
- 2,615
- 6
- 26
- 43
5
votes
3 answers
In Rails, should I use the generators?
I've encountered information that implies most experienced Rails developers don't use scaffolding. Do most experienced Rails developers even use the generators for Models, Controllers, and Migrations?
For example, as a seasoned Rails developer would…

AdamT
- 6,405
- 10
- 49
- 75
5
votes
1 answer
Using Geocoder, is there a way to save out the street name, city and zip to seperate columns?
I'm in the process of switching my app to use geocoder. In my places table I have columns for address, lat, lng, street_address, city & zip. Using geocoder I'm happily able to fill lat, lng & address columns after validation with with the…

Tim Sutcliffe
- 185
- 1
- 10
5
votes
1 answer
Geocoding API not responding fast enough
I am using the Geocoder gem but lately it does not seem to work.
I get this error:
Geocoding API not responding fast enough (use Geocoder.configure(:timeout => ...) to set limit).
My application_controller.rb is:
before_filter :lookup_ip_location
…

Petros Kyriakou
- 5,214
- 4
- 43
- 82
5
votes
1 answer
How does Rails Geocoder Gem access Google API?
I know that we need to use a unique API key to access the Google Geocoding API.I am using the Rails Geocoder Gem in my application and found out that it uses the Google Geocoding API.I was unable to find any configuration files that define the API…

Sooraj Chandu
- 1,348
- 16
- 35
5
votes
2 answers
Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method
When using this query (the same as in Railscasts episode #273):
@locations = Location.near(params[:search], 50, :order => :distance)
Or, to be more concise:
@mymodels = MyModel.near(address, distance, order: :distance)
I get the error:…

Ecnalyr
- 5,792
- 5
- 43
- 89