Questions tagged [geokit]

A Ruby on Rails gem that provides geocoding and distance calculations.

Geokit is a Rails gem that provides geocoding and distance calculations.

It provides various geocoding and geolocation options, including:

  • Distance calculations between two geographical points
  • Check whether a certain point is within certain rectangular bounds
  • Support of multiple geocoding data providers - Google, Yahoo and others
141 questions
0
votes
1 answer

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 "listings" table? I've like I said, have it…
0
votes
1 answer

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've tried placing it in another page, but it seems…
Dan
  • 139
  • 1
  • 6
0
votes
1 answer

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 geokit-rails in a Rails 5 app? Does it have…
Tyler
  • 19,113
  • 19
  • 94
  • 151
0
votes
1 answer

undefined method `within'

I followed the installation procedure of geokit-rails3, here is my conf : Using rails (3.0.4) Using activerecord (3.0.4) Using geokit (1.5.0) Using geokit-rails (1.1.4) I get this error "undefined method `within' for #" when i try to query with…
vdaubry
  • 11,369
  • 7
  • 54
  • 76
0
votes
1 answer

Ruby gem geokit and :within maximum or tolerance?

Just started playing with geokit and trying some things out... Things are pretty much working as expected, given a point, its finding things nearby. However, if I set :within to be a large value, say 100,000, using :miles, I would expect to get most…
Chris Kimpton
  • 5,546
  • 6
  • 45
  • 72
0
votes
1 answer

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.distance_from(@geocoded_location, units:…
Georgeheap
  • 85
  • 11
0
votes
0 answers

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 method isn't working at all, and the distances…
Anthony Pinto
  • 287
  • 1
  • 3
  • 10
0
votes
1 answer

Geokit in Ruby on Rails, distance finder, how to sort by nearest to farthest?

I'm using Geokit. I have the following in my model: # Distance-based finder method # Usage: # - find_this_within(Shop.first, 10) def self.find_this_within(origin, within) if origin.geocoded? find(:all, :origin => origin, :within =>…
Victor
  • 13,010
  • 18
  • 83
  • 146
0
votes
2 answers

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 through UserLocations and Orders have locations…
Edie W.
  • 667
  • 2
  • 9
  • 24
0
votes
0 answers

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 'does any part of this logical unit lie on my map'? …
Paul D Smith
  • 639
  • 5
  • 16
0
votes
1 answer

scoped and find_within

Iam using geokit-rails (http://github.com/jlecour/geokit-rails branch gem). I like to build a scope like a = MyModel.scoped a = a.limit(10).scoped a = a.find_within(10,:origin => [mylat,mylng]).scoped a = a.where(:visible => true) a =…
User0815
  • 7
  • 1
  • 5
0
votes
1 answer

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?
pedroooo
  • 563
  • 1
  • 4
  • 17
0
votes
1 answer

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::Base belongs_to :route acts_as_mappable end Actually, I…
Alain ANDRE
  • 305
  • 1
  • 13
0
votes
1 answer

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::Base belongs_to :route acts_as_mappable end I'm trying…
Alain ANDRE
  • 305
  • 1
  • 13
0
votes
2 answers

gem customizations

I added some caching functionality to the geokit gem and used gemcutter to create a copy 'badnaam-geokit'. The only changed are in Geocoders.rb which works fine if I just modify it locally. However, after I published it to rubygems and installed it…
badnaam
  • 1,876
  • 4
  • 29
  • 53