collectiveidea / acts_as_geocodable Goto Github PK
View Code? Open in Web Editor NEWSimple geocoding for Active Record models
License: Other
Simple geocoding for Active Record models
License: Other
Take the example on the site with Events. If Events habtm Locations and the Locations are what acts_as_geocodable, how do we go about searching for Events by geocode? Thanks!
I just wanted to point you to http://github.com/parolkar/geo_mere_laal , Which is another modern way of approaching Geo-Awareness
Encountering "super: no superclass method `precision='" on Rails 2.3.2 when looking up a geocode that hasn't been looked up before.
I put a rescue block around that in my fork for the time being.
Is it possible to use multiple geocoders? I've seen issues where a service won't recognize an address, even though it is valid, and another service will. Would be nice if we could fallback if the address isn't recognized. Is this possible?
http://github.com/tomwaddington/acts_as_geocodable/commit/de92a5b0647bef1a3ac7527c6590a4a7276a3b21
We should incorporate something like that patch, but it needs to be smarter about how the address mapping is performed.
Geocode.create.precision
NameError: uninitialized constant Graticule::Precision
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:inload_missing_constant' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in
rake_original_const_missing'
from /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:inconst_missing' from /Library/Ruby/Gems/1.8/gems/acts_as_geocodable-1.0.2/lib/acts_as_geocodable/geocode.rb:38:in
precision'
from (irb):11
I run Rails 2.3.5, acts_as_geocodable 1.0.2 and Graticule 0.2.12
collectiveidea/graticule@5a2b604
Gracticule 2.4.0 doesn't raise custom error messages due to the minor mistake above. Would be sweet to bump the version constraint to 2.5 (given everything still works) where this has been removed.
Also opened an issue on Graticule to release a minor or patch version to fix this that you could then allow. So that would be equally as cool thanks!
Hi,
When I do :
acts_as_geocodable :address => {:street => :street_1, :locality => :city}
I get :
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first.
With Rails 3.1.rc8 and ruby 1.9.2
It seems to normalize street and city, but not region or country. Using latest gem versions (Graticule 2.0.0 and acts_as_geocodable 2.0.0).
When I try to launch my server (rails s) I got this error with rails 3.2.rc1 :
https://gist.github.com/a99d0ac6ce164d547618
I note very sure if it's related to acts_as_geocodable or rails. But if I launche my app without your gem, this error disappear.
Juste in case, my issue on Rails repo : rails/rails#4046
Hi,
I have a warning deprecation with acts_as_geocodable.
At this line : acts_as_geocodable :address => {:street => :street_1, :locality => :city, :postal_code => :postal_code, :country => :country}
This Warning : DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in Establishment instead.
With rails 3.2 and ruby 1.9.3
Is it possible to include timezone information with the geocodes?
Thanks for this plugin - it's really great.
I have a few instances where I need to mimic acts_as_geocodable behavior on ActiveModel compliant classes. I've introduced some hackery on my end to get around the scopes and the associations, etc.
My question is, would it be of interest for others if I abstracted things out a bit more so that scopes and other AR specifics were optionally loaded as part of the acts_as_geocodable call?
I'm thinking something along the lines of detecting if the class is an AR descendant or passing an argument to the method call like:
acts_as_geocodable :scopes_and_associations => false
I had some issues when running the generators in Rails 3.0beta4
It says, "could not find generator geocodable_migration."
I have a geocodable model that fails to be saved with the following error (Rails 3, Ruby 1.9.2) :
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
After further investigations it looks that the problem comes from the answer of :
geocoder.locate(location)
which returns ASCII rather than UTF-8 and ruby fails with "l'Abb\xC3\xA9"
Rue de l'Abb\xC3\xA9 Chanlon\nF\xC3\xA9nay, Bourgogne 21600 FR
I don't know if this issue is more graticule related or it should be fixed in acts_as_geocodable ... but it only exists with Google API, Yahoo API seems to works fine.
There seem to be an issue with Yandex Maps API integration. When I try to get coordinates for the same address, but typed in different ways, e.g. (addressed are for Санкт-Петербург):
though direct query to Yandex API return correct result with lat/long coordinates http://geocode-maps.yandex.ru/1.x/?geocode=Санкт-Петербург,+лиговский+проспект+74
Hi everybody,
I have a simple class Store that acts_as_geocodable, in Rails 2.3.x, as shown below:
acts_as_geocodable :address => {:street => :address, :locality => :locality_name, :region => :region_name}
def region_name
region.name || ''
end
def locality_name
city || province.name
end
:address is an ActiveRecord field. I'd like to run such a query:
Store.find(:all, :within => 10, :origin => "80026")
to find all stores matching that origin. But I get this error:
*NoMethodError: undefined method locate' for nil:NilClass from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:in
method_missing'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/acts_as_geocodable-1.0.0/lib/acts_as_geocodable/geocode.rb:23:in create_by_query' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/acts_as_geocodable-1.0.0/lib/acts_as_geocodable/geocode.rb:19:in
find_or_create_by_query'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/acts_as_geocodable-1.0.0/lib/acts_as_geocodable.rb:134:in location_to_geocode' from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/acts_as_geocodable-1.0.0/lib/acts_as_geocodable.rb:86:in
find'
from (irb):10
When an app use active_record.whitelist_attributes = true (default with rails 3.2.3), geocoding isn't done anymore. I suppose that the attr_accessible aren't set corretly in the gem.
acts_as_geocodable/tasks/acts_as_geocodable_tasks.rake are deprecated. Use lib/tasks instead.
I'm using rails 3 and am using this gem for a project of mine.
This works
Organization.joins(:skills).where("skills.id IN (1,2,3,4,5,6)").origin("17522", :within => 20)
This seems to work but then gives a NoMethodError: undefined method `distance'
Organization.includes(:skills).where("skills.id IN (1,2,3,4,5,6)").origin("17601", :within => 20)
Any idea how to get the includes working with acts_as_geocodable?
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.