This project has been integrated into geokit-rails
geokit / geokit-rails3 Goto Github PK
View Code? Open in Web Editor NEWPort of the Rails plugin "geokit-rails" to Rails 3, as a gem
License: MIT License
Port of the Rails plugin "geokit-rails" to Rails 3, as a gem
License: MIT License
This project has been integrated into geokit-rails
I have model with acts_as_gmappable (gmaps4rails) and acts_as_mappable (Geokit) declarations and MyModel.create gives this error:
NoMethodError:
undefined method `empty?' for #Geokit::GeoLoc:0x45ef820
..
..
Could somebody help me?
Wrong project, can be closed
Actually the first thing I expected was that I did something wrong, but after trying it out various times I'm still getting this error when opening up the index controller of the following model:
class Location < ActiveRecord::Base
acts_as_mappable :default_units => :kms
has_many :devices
validates_presence_of :name
end
here's my Gemfile (even tried the default one):
source 'http://rubygems.org'
gem 'rails', '>= 3.0.3'
gem 'mysql2'
gem 'devise'
gem 'hpricot'
gem 'ruby_parser'
gem 'compass', '>= 0.10.6'
gem 'compass-susy-plugin'
gem 'compass-colors'
gem 'simple-navigation'
gem 'geokit-rails3', '>= 0.1.3'
gem 'haml'
I also tried out the geocoder gem, but I'm experiencing similar issues too - even with a plain new rails application. What I found out is that in both cases there are no configuration/initialisation files are being created by running "bundle install", but for other gems that come with a rake task like devise ("rake devise:install") they are.
Actually it still sounds like a misconfiguration, but I couldn't find a reason for this in hours of search that's why I'm trying my help here.
I've installed this gem as described in the documentation, with bundler, but i don't see any "geokit_config.rb" in my config/initializers/ folder
Hi all, do this gem support function to get all name + zipcode city by search with a text?
Thank for help :)
Hi,
I've the following query:
@users_carousel = User.find(:all,
:order => 'users.updated_at desc',
:limit => User::MAX_USERS_IN_CAROUSEL,
:origin => visitor_ip,
:include => :pictures,
:conditions => 'pictures.picture_file_name IS NOT NULL')
But I get this error:
Unknown key(s): origin
It was working with repository http://github.com/jlecour/geokit-rails
but I was getting an error with geokit with this gem that's why I've tryed the fork geokit-rails3.
Thanks for your fork :)
mysql2
is not a supported adapter.
Is it supposed to work with mysql2? I read a post on the interwebs that suggested so, but now it does not work. :-(
Unfortunately, I am stuck with rails 1.8.7 until this works, as the mysql gem breaks with rails 3 and UTF-8 databases.
Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.7) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.7) Using erubis (2.6.6) Using rack (1.2.3) Using rack-mount (0.6.14) Using rack-test (0.5.7) Using tzinfo (0.3.27) Using actionpack (3.0.7) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.19) Using actionmailer (3.0.7) Using arel (2.0.10) Using activerecord (3.0.7) Using activeresource (3.0.7) Using addressable (2.2.6) Using bundler (1.0.15) Using diff-lcs (1.1.2) Using multipart-post (1.1.2) Using faraday (0.6.1) Using faraday_middleware (0.6.3) Using geokit (1.5.0) Using thor (0.14.6) Using railties (3.0.7) **Using rails (3.0.7)** **Using geokit-rails3 (0.1.3) from git://github.com/jlecour/geokit-rails3.git (at master)** Using hashie (1.0.0) Using hpricot (0.8.4) Using htmlentities (4.3.0) Using memcache-client (1.8.5) Using multi_json (1.0.3) Using multi_xml (0.2.2) **Using mysql2 (0.2.7)** Using newrelic_rpm (3.0.1) Using oauth (0.4.4) Using proxies (0.2.1) Using rash (0.3.0) Using rmagick (2.13.1) Using rspec-core (2.6.4) Using rspec-expectations (2.6.0) Using rspec-mocks (2.6.0) Using rspec (2.6.0) Using rspec-rails (2.6.1) Using s3 (0.3.8) Using simple_oauth (0.1.5) Using twitter (1.5.0) Using will_paginate (3.0.pre2) Using xml-simple (1.0.16)
vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:142:in
rescue in adapter'
vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:136:in adapter' vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:428:in
sphere_distance_sql'
vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:233:in distance_sql' /Users/janbromberger/.rvm/gems/ruby-1.9.2-p180/bundler/gems/geokit-rails3-d8d387e1c7c5/lib/geokit-rails3/acts_as_mappable.rb:120:in
geo_scope'
activerecord (3.0.7) lib/active_record/relation.rb:370:in block in method_missing' activerecord (3.0.7) lib/active_record/relation.rb:125:in
scoping'
activerecord (3.0.7) lib/active_record/relation.rb:370:in method_missing' app/controllers/auction_controller.rb:107:in
city'
actionpack (3.0.7) lib/action_controller/metal/implicit_render.rb:5:in send_action' actionpack (3.0.7) lib/abstract_controller/base.rb:150:in
process_action'
actionpack (3.0.7) lib/action_controller/metal/rendering.rb:11:in process_action' actionpack (3.0.7) lib/abstract_controller/callbacks.rb:18:in
block in process_action'
activesupport (3.0.7) lib/active_support/callbacks.rb:457:in block in _run__3284931773042869005__process_action__699191996614909694__callbacks' activesupport (3.0.7) lib/active_support/callbacks.rb:221:in
block in _conditional_callback_around_305'
app/controllers/application_controller.rb:280:in save_crawl' activesupport (3.0.7) lib/active_support/callbacks.rb:220:in
_conditional_callback_around_305'
activesupport (3.0.7) lib/active_support/callbacks.rb:441:in _run__3284931773042869005__process_action__699191996614909694__callbacks' activesupport (3.0.7) lib/active_support/callbacks.rb:410:in
_run_process_action_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in run_callbacks' actionpack (3.0.7) lib/abstract_controller/callbacks.rb:17:in
process_action'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:30:in block in process_action' activesupport (3.0.7) lib/active_support/notifications.rb:52:in
block in instrument'
activesupport (3.0.7) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.0.7) lib/active_support/notifications.rb:52:in
instrument'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.0.7) lib/action_controller/metal/rescue.rb:17:in
process_action'
newrelic_rpm (3.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in block in process_action' newrelic_rpm (3.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:253:in
block in perform_action_with_newrelic_trace'
newrelic_rpm (3.0.1) lib/new_relic/agent/method_tracer.rb:193:in trace_execution_scoped' newrelic_rpm (3.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:248:in
perform_action_with_newrelic_trace'
newrelic_rpm (3.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in process_action' actionpack (3.0.7) lib/abstract_controller/base.rb:119:in
process'
actionpack (3.0.7) lib/abstract_controller/rendering.rb:41:in process' actionpack (3.0.7) lib/action_controller/metal.rb:138:in
dispatch'
actionpack (3.0.7) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.0.7) lib/action_controller/metal.rb:178:in
block in action'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in call' actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in
dispatch'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:27:in call' rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in
block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in block in recognize' rack-mount (0.6.14) lib/rack/mount/code_generation.rb:124:in
optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in recognize' rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in
call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:493:in call' newrelic_rpm (3.0.1) lib/new_relic/rack/browser_monitoring.rb:18:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' actionpack (3.0.7) lib/action_dispatch/middleware/head.rb:14:in
call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in call' actionpack (3.0.7) lib/action_dispatch/middleware/params_parser.rb:21:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/flash.rb:182:in call' actionpack (3.0.7) lib/action_dispatch/middleware/session/abstract_store.rb:149:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/cookies.rb:302:in call' activerecord (3.0.7) lib/active_record/query_cache.rb:32:in
block in call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in cache' activerecord (3.0.7) lib/active_record/query_cache.rb:12:in
cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:31:in call' activerecord (3.0.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:46:in block in call' activesupport (3.0.7) lib/active_support/callbacks.rb:416:in
_run_call_callbacks'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:44:in call' rack (1.2.3) lib/rack/sendfile.rb:107:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/remote_ip.rb:48:in call' actionpack (3.0.7) lib/action_dispatch/middleware/show_exceptions.rb:47:in
call'
railties (3.0.7) lib/rails/rack/logger.rb:13:in call' rack (1.2.3) lib/rack/runtime.rb:17:in
call'
activesupport (3.0.7) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.2.3) lib/rack/lock.rb:11:in
block in call'
internal:prelude:10:in synchronize' rack (1.2.3) lib/rack/lock.rb:11:in
call'
actionpack (3.0.7) lib/action_dispatch/middleware/static.rb:30:in call' railties (3.0.7) lib/rails/application.rb:168:in
call'
railties (3.0.7) lib/rails/application.rb:77:in method_missing' passenger (3.0.7) lib/phusion_passenger/rack/request_handler.rb:96:in
process_request'
passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:513:in accept_and_process_next_request' passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:274:in
main_loop'
passenger (3.0.7) lib/phusion_passenger/rack/application_spawner.rb:205:in start_request_handler' passenger (3.0.7) lib/phusion_passenger/rack/application_spawner.rb:170:in
block in handle_spawn_application'
passenger (3.0.7) lib/phusion_passenger/utils.rb:479:in safe_fork' passenger (3.0.7) lib/phusion_passenger/rack/application_spawner.rb:165:in
handle_spawn_application'
passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:357:in server_main_loop' passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:206:in
start_synchronously'
passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:180:in start' passenger (3.0.7) lib/phusion_passenger/rack/application_spawner.rb:128:in
start'
passenger (3.0.7) lib/phusion_passenger/spawn_manager.rb:253:in block (2 levels) in spawn_rack_application' passenger (3.0.7) lib/phusion_passenger/abstract_server_collection.rb:132:in
lookup_or_add'
passenger (3.0.7) lib/phusion_passenger/spawn_manager.rb:246:in block in spawn_rack_application' passenger (3.0.7) lib/phusion_passenger/abstract_server_collection.rb:82:in
block in synchronize'
internal:prelude:10:in synchronize' passenger (3.0.7) lib/phusion_passenger/abstract_server_collection.rb:79:in
synchronize'
passenger (3.0.7) lib/phusion_passenger/spawn_manager.rb:244:in spawn_rack_application' passenger (3.0.7) lib/phusion_passenger/spawn_manager.rb:137:in
spawn_application'
passenger (3.0.7) lib/phusion_passenger/spawn_manager.rb:275:in handle_spawn_application' passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:357:in
server_main_loop'
passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:206:in start_synchronously' passenger (3.0.7) helper-scripts/passenger-spawn-server:99:in
I have a model, User
, with the following line:
acts_as_mappable :through => { :profile => :address }
I expected the following to work:
User.in_bounds(bounds).all
It doesn't. I get error messages like Unknown column 'addresses.lat' in 'where clause'
. I need to do the following:
User.includes(:profile => :address).in_bounds(bounds).all
...and everything will work.
Greetings,
I'm having an issue with the gem concerning the escaping of the characters before the api call to google or yahoo is made. Let's say, I have the following address: "Hardturmstrasse 253 Zürich". When the parameters are escaped in order to be inserted in the api call (geocoder.rb, line 594), they are apparently wrongly escaped. So, the call in the same line to Geokit::Inflector::url_escape("Hardturmstrasse 253 Zürich") produces the following result: "Hardturmstrasse+253+Z%C3rich". Well, the api call returns no results for such an address. The specific problem here is how the "ü" character is being escaped. Escaping then "Zürich" with the URI.escape function, I get the following encoding for it: "Z%C3%BCrich". I use it in the api call, and... it works. Do you have any idea why the escaping is going wrong in such cases?
Regards,
Tiago
Hi everyone, is this gem support for mongodb ?
I have this error and don't know how to fix it.
Please give me some advise , thank you
From the README:
If you don't already have a geokit_config.rb file, the plugin creates one when it is first installed.
...which is not happening cause it's a gem.
Right now there is no way of generating this file, so I copied the one from: https://github.com/andre/geokit-gem
Still, it is confusing in the docs.
We should [a] either replace
If you don't already have a geokit_config.rb file, the plugin creates one when it is first installed.
with something like
You can get a sample configuration from .....
or [b] write a simple generator that shows up as
geokit:install
when running
rails g -h
and which simply copies the very same file to config/initializers.
Personally I think [2] should be the way to go to keep the gem more self-contained.
This doesn't appear to work at all with Rails scopes. When used as described in the README it works fine. When used on a scope on the same class:
Unknown key(s): origin
The geokit-rails3.gemspec file specifies 'rails', '~> 3.0.4' which prevents the gem from installing to a rails 3.1 project. Could you switch it to 'rails', '>= 3.0.4'?
I know this is documented as "this doesn't work yet, please help" on the README, but there is no Issue to track this. I figure if an issue exists, then people will know that others are actually wishing this was fixed. I know I need it!
PG::Error: ERROR: column "distance" does not exist
This occurs when you do something like:
stuff = Model.include(:photos).geo_scope(:origin => [latitude, longitude], :within => 100)
stuff = stuff.where(:published => true)
When you use where on the ARel chain, somehow DISTANCE is removed from the query, and no longer exists.
Please fix!
GoogleGeocoder.geocode '東京'
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
from /Users/tomo/.rvm/gems/ruby-1.9.3-p125/gems/geokit-1.6.5/lib/geokit/geocoders.rb:464:in do_geocode' from /Users/tomo/.rvm/gems/ruby-1.9.3-p125/gems/geokit-1.6.5/lib/geokit/geocoders.rb:129:in
geocode'
from (irb):6
from /Users/tomo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.7/lib/rails/commands/console.rb:47:in start' from /Users/tomo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.7/lib/rails/commands/console.rb:8:in
start'
from /Users/tomo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.7/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:in
require'
from script/rails:6:in `
Attempting to run with the current version of Geokit (1.7.1) results in: uninitialized constant Geokit::Railtie::GeoKit (NameError).
call in acts_as_mappable.rb:
sql = sphere_distance_sql(origin, units)
and code in adapters/postgresql.rb:
def sphere_distance_sql(lat, lng, multiplier) # ...
and
def flat_distance_sql(origin, lat_degree_units, lng_degree_units)
Same thing in mysql.rb and mysql2.rb (and probably the others):
Hi there,
I´ve got some errors if a request included a mutated vowel like 'ü'
Something has gone very wrong during geocoding, OR you have configured an invalid class name in Geokit::Geocoders::provider_order. Address: Güstrow. Provider: google
Something has gone very wrong during geocoding, OR you have configured an invalid class name in Geokit::Geocoders::provider_order. Address: Güstrow. Provider: us
How can i get the way points between two locations
I've noticed that:
@nearest_pois = Poi.within(radius, :units => :km, :origin => [lat,lng], :order => 'distance ASC').limit(limit)
and
@nearest_pois = Poi.within(radius, :units => :km, :origin => [lat,lng], :order => 'distance DESC').limit(limit)
gives the same result.
It's like sorting has no effect.
This is my Poi configuration:
acts_as_mappable :default_units => :kms,
:default_formula => :sphere,
:distance_field_name => :distance,
:lat_column_name => :lat,
:lng_column_name => :lng
Is there something wrong?
Location.find(:all, :origin => @Somewhere)
ArgumentError: Unknown key(s): origin
i am using rails 3.0.7
Specifiying a distance_to
with two locations that are basically right on top of each other raises a Math::DomainError.
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/geokit-1.6.5/lib/geokit/mappable.rb:46:in `acos'
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/geokit-1.6.5/lib/geokit/mappable.rb:46:in `distance_between'
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/geokit-1.6.5/lib/geokit/mappable.rb:178:in `distance_to'
acts_as_mappable :default_units => :miles,
:default_formula => :sphere,
:distance_field_name => :distance,
:lat_column_name => :o_lat,
:lng_column_name => :o_lng
@journeys = Journey.find(:all, :origin=>[g.lat,g.lng]:conditions => [all_conditions, arguments],:order=>'distance')
I am getting unknown column distance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.