Questions tagged [geokit]
A Ruby on Rails gem that provides geocoding and distance calculations.
142
questions
0
votes
0
answers
22
views
gem install geokit fails to install
I'm unable to install the Geokit ruby gem. Tried with ruby 2.6.2 and ruby 2.7.4.
When running gem install geokit I get the following output.
Successfully installed geokit-1.13.1
Parsing documentation ...
0
votes
0
answers
80
views
NoMethodError - undefined method `*' for nil:NilClass - How to store user's HTML5 location to the user's session in Rails?
My web app is https://proptrics.com
I'm running a Ruby on Rails (v6.0.3.4) application in a Docker container on a network using Docker Compose hosted on a Digital Ocean droplet (Ubuntu 20.04.1 LTS). I'...
-2
votes
1
answer
130
views
How to use AJAX request to pass user's HTML5 location in a class variable from JavaScript to Rails controller?
I'm using Ruby (2.7.2p137), Ruby on Rails (v6.0.3.4) and Geokit-rails (2.3.2).
I'm trying to pass the user's location into a method from the Geokit-rails gem. To do this, I am trying to use an AJAX ...
0
votes
1
answer
81
views
Whats the most efficient way to get areas where lat/lng fall under?
area has many coordinates
coordinate model has two attributes: latitude and longitude
Is there anyway to refactor this? Right now it works, but it does a kind of n+1 query:
areas.each_with_object([])...
0
votes
1
answer
951
views
Why does Sorbet think that a method I provided an explicit signature for in an RBI file doesn't exist?
One of my classes depends on the gem Geokit, which doesn't provide an RBI file of its own nor is it included in the sorbet-typed repo. I hand-wrote a couple RBI files for it myself, including ...
0
votes
1
answer
113
views
Confused on how to setup Geokit
So I've searched through all the documentation on Geokit for rails and didn't find any setup process for it except for installing the gem which I know how to do. what tables do I add to an existing "...
1
vote
1
answer
684
views
Get bounding box from array of points
I have a Rails 5 API only project. I have nodes that have latitude/longitude details stored on them. I am using the Rails Geokit gem to do some of the other geographic work.
I want to return to the ...
1
vote
1
answer
39
views
ArgumentError: Unknown key: origin using geokit-rails
I have a rails 4 app where I am trying to find all applications within N number of miles. Based on geokit-rails documention HERE I should be able to do:
SapApplication.find(:all, :origin=>'100 ...
1
vote
1
answer
137
views
Ruby On Rails Geokit gem geocoding returning nil
I am struggling with using the geokit gem in a Ruby on Rails application when supplied with an address to return anything other than nil.
I've read the previous articles here on Stack Overflow, the ...
0
votes
1
answer
506
views
Search bar does not work unless i Refresh the page
I have an issue where I have a search bar that searches my database via names and location. This does work. However, I have to actually refresh the page most of the time in order for it to work. I'...
0
votes
1
answer
75
views
Geokit-rails fresh setup, Could not find table 'locations' Rails 5
I followed the directions here but when I run Location.all, I get
ActiveRecord::StatementInvalid: Could not find table 'locations'
Are there any extra setup steps or configuration required for using ...
2
votes
0
answers
59
views
Does geokit-rails use "point" columns and spatial indexes when using mysql?
If it doesn't, how is the performance compared to me rolling my own using point/spatial indexes? When looking for records within N miles of another record.
To be more precise I have a table with a ...
1
vote
1
answer
394
views
GeoKit API response is unreliable, Gives different responses every time for same payload
GeoKit gem version: 1.11.0
Payload: "3880 S El Camino Real, San Mateo, CA 94402, USA"
Api call: Geokit::Geocoders::MultiGeocoder.geocode(payload)
Response 1: "Provider: Google, Street: 3880 S El ...
1
vote
1
answer
553
views
Does Geokit use a default google API key?
I'm trying to debug a "too many queries" error I'm getting in my rails app. It appears that the rate limit is being surpassed. I'm trying to locate where the app is providing a Google Geocoding ...
0
votes
1
answer
338
views
Format distance_from returned by Geokit
I am struggling to format the way that geocoder is returning the distance from one location to another.
Here is the code:
Jbuilder file:
json.array! results do |result|
json.distance result....
1
vote
2
answers
84
views
cannot use geokit or Geocoder inside property_web_builder engine
I was customizing the property_web_builder engine for getting nearby results using Geokit or Geocoder gem, but can't use any of it.
getting undefined method 'gecoded_by' using 'Geocoder' gem and ...
1
vote
0
answers
47
views
Geokit first time finds the address and when we ran this again it will not find the address
I m using a geokit and geokit-rails gem. when i m finding the address it give me below warning.
An error has occurred during geocoding: Geokit::TooManyQueriesError
Geokit::Geocoders::MultiGeocoder....
1
vote
3
answers
685
views
Reverse query a location in Rails-Geocoder with max distance attribute
For an example, I have a model like this
class Place < ActiveRecord::Base
# has a "latitude" & "longitude" field
# notice it has "max_distance" field (meter), will be different on each ...
0
votes
0
answers
139
views
by_distance method not working (rails)
So, I'm using geokit-rails and I would like to sort by distance, specifically showing the nearest meals first and descending from there. e.g. 5km, 10km, 15km.
However, for some reason the distance_by ...
1
vote
2
answers
2k
views
Calculating the distance between 2 latitude and longitude locations in a rails project
I am using the
geokit-rails
gem to calculate the distance between 2 objets which contain latitude and longitude fields: https://github.com/geokit/geokit-rails
I have a Leg object - which ...
0
votes
2
answers
224
views
Geokit location undefined method `lat' with :through
I am trying to find all the Drivers within the distance of the Order 'pickup_address', as explained in the GeoKit guide https://github.com/geokit/geokit-rails#using-through
Drivers have locations ...
2
votes
2
answers
339
views
Rails sort child model based on parent model distance calculation
I have a product model and a shop model. The relationship between two is shop has_many products and products belongs_to shop.
The shop model has two fields longitude and latitude used for distance ...
1
vote
1
answer
339
views
Rails 5 IntegrationTest with IP Geolocation
I'm making use of the geokit-rails gem to perform geolocation based on the IP address of the user who is logging in via #geocode_ip_address (https://github.com/geokit/geokit-rails#ip-geocoding-helper)....
1
vote
1
answer
252
views
ERROR -- : Caught an error during Google geocoding call: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
I am trying to get the address when inputting coordinates like so in my model.
def full_address
Geocoder.address("#{self.latlon.x}, #{self.latlon.y}")
end
However, sometimes it works ...
0
votes
0
answers
72
views
Create Geokit bounds from many points
Is there a simple way to create a Geokit bounds that encompasses a number of points and/or polygons? I have an application where disjoint groups of polygons form a logical unit and I want to know '...
1
vote
2
answers
693
views
What is the best way to show location in Rails 4 app?
I'm building an app for a client. The client want to be able to display street map with its location on the contact page.
I've never used maps in a web app before and I've been googling around.
...
0
votes
1
answer
121
views
Search by location using an array with geokit gem
I need to search on two or more locations
model = Model.in_range("0".."5",:origin => [LatLng, LatLng, LatLng, LatLng)
is posible?
0
votes
1
answer
86
views
geokit-rails getting the route passing close to 2 points
I'm having a route model
class Route < ActiveRecord::Base
has_many :etapes
acts_as_mappable :through => :steps
end
and a step one (that contains lat and lgn)
class Step ActiveRecord::...
0
votes
1
answer
1k
views
Rails activerecord joins and duplicates data
I'm having a route model
class Route < ActiveRecord::Base
has_many :etapes
acts_as_mappable :through => :steps
end
and a step one (that contains lat and lgn)
class Step ActiveRecord::...
2
votes
1
answer
2k
views
Rails Heroku SocketError: getaddrinfo: Name or service not known
I am on a heroku app, Ruby 2.2.0, Rails 4.0.12 and using the geokit-rails gem.
When I do a IpGeocoder.geocode(request.remote_ip) I get the error:
Caught an error during Ip geocoding call: ...
0
votes
1
answer
691
views
Geokit not working with geocoder.us and google api
My Geokit plugin was working fine but after geocoder.us down it stops working and showing error. Geokit::Geocoders::GeocodeError. Now How can I disable geocoder.us service and use only geocoder.ca and ...
3
votes
1
answer
194
views
Geokit ActiveModel::MissingAttributeError: can't write unknown attribute `within`
In my Firm class I have
acts_as_mappable :lat_column_name => :latitude,
:lng_column_name => :longitude
I'm trying to test geokit. I assign f = Firm.first and run
Firm.within(...
1
vote
1
answer
95
views
Which post code is the nearest with Geokit?
I'm using geokit to give me distances between two post codes. I need to determine which post code is the nearest.
point_a = Geokit::Geocoders::GoogleGeocoder.geocode "se18 7hp"
alpha = ["cr0 3rl", "...
4
votes
1
answer
935
views
Geokit Rails distance and find(:all)
I have 2 questions regarding the gem 'geokit-rails'
This is my sample code
class Outlet < ActiveRecord::Base
acts_as_mappable :lat_column_name => :address_latitude,
:...
0
votes
1
answer
1k
views
Ruby on Rails | Get all areas, cities, countries in the world
How could I possibly get a list of all areas, cities,states, countries in the world like Zomato has. Is there any Gem that can help me. I have searched for few GEMS (django-cities, WorldCityLocations) ...
0
votes
1
answer
60
views
Trying to display content on side bar based on the visitors location
I am trying to display a list of salons that correspond to the users location on the show view of treatment.
The two tables don't have a direct relationship.
I have installed the geokit gem and now ...
1
vote
1
answer
108
views
Why does Google's Geolocation API think that localhost is in Iraq?
Using the geokit gem in irb:
>> Geokit::Geocoders::secure = false
=> false
>> Geokit::Geocoders::MultiGeocoder.geocode("::1").full_address
=> "1, Madain, Iraq"
What the...?
0
votes
1
answer
1k
views
RoR: How to get lat and lng using geokit-rails
I want to display a google maps centered at the user's location. I am willing to use gmaps4rails and geokit-rails gems, because I guess those are the best ones.
What I have so far is the map ...
0
votes
1
answer
198
views
If geokit-rails no longer has geo_scope method, what I am supposed to use to get lat/long of an address
Looking at the latest release of geokit-rails (2.1.0), it looks like they have removed the method geo_scope (https://github.com/geokit/geokit-rails/commit/781c4dc62d3b044196efbfad269d4780e6afbe6b).
...
1
vote
0
answers
95
views
geokit-rails patched ActiveRecord find method
Rails 4.1.12
ruby 2.1.0
restaurant.rb
class Restaurant < ActiveRecord::Base
...
acts_as_mappable :through => :address
...
end
So when I try Restaurant.find(1) the exception raised.
2.1....
4
votes
2
answers
4k
views
How do I obtain a geonames API key
My apologies for the basic question, I am just starting to use Geonames.
The Ruby geokit gem contains the following instruction for using Geonames:
# To use this service either free or premium, you ...
4
votes
2
answers
774
views
Geokit undefined method `acts_as_mappable' rails
I used the geokit-rails gem in my web application on my local machine i followed the steps from their github repo and it worked flawlessly on my local machine but once i deployed my app on openshift ...
4
votes
1
answer
1k
views
Geokit issue - "could not find generator"
I am trying to get started with Geokit, and I ran the install command and was greeted with the following:
rails g geokit_rails:install
Could not find generator geokit_rails:install.
Any idea what's ...
1
vote
1
answer
63
views
Convert a complex Sql query to Rails
I am using gem geokit rails in my app. I have a table that contains various addresses. I am trying to use the geokit feature by_distance which finds records ordered by distance from the origin point.
...
1
vote
1
answer
94
views
Using Geokit and Geocoding to print value
I have a Model Stop as such.
class Stop < ActiveRecord::Base
geocoded_by :address
after_validation :geocode
acts_as_mappable defaults_units: :kms, lat_column_name: :latitude, ...
1
vote
1
answer
587
views
Using Geokit-Rails, How can I find all fields within a distance OR have a bit value set to 1
I have a project where users can search for results within a specified distance of their location, e.g. within 10 miles of their postcode. I am using geokit-rails for this and it works great using the ...
0
votes
1
answer
229
views
Rails: Geokit incorrectly converting IPv4 address to latitude and longitude
I want to convert two IPv4 addresses to latitude and longitude, then calculate the geographical distance between them.
Geokit says it can do this.
Seattle:
a = Geokit::Geocoders::GoogleGeocoder....
0
votes
2
answers
2k
views
How to use Geokit on a rails project
I am using Rails 4.2.0 and Ruby 2.2.0. I want to use geokit to convert an address to latitude and longitude. I already did gem install geokit in my terminal. I also included gem 'geokit' in my Gemfile,...
0
votes
1
answer
94
views
Error while using Geokit-Rails in model instance method
I am trying to use geokit-rails' .within helper method in a model instance method. Take a look here:
def self.crunch
users = User.all
users.each do |user|
last_movement = ...
1
vote
1
answer
189
views
Simple Acts_as_mappable "through" not working
Using the geokit-rails gem, I have:
Employer.rb model, with lng & lat attributes:
has_many :jobs, dependent: :destroy
acts_as_mappable
Job.rb model, with no lng or lat
acts_as_mappable :...