Git Product home page Git Product logo

geokit-rails3's Introduction

Geokit

Gem Version Build Status Coverage Status Reviewed by Hound Code Climate

DESCRIPTION

The Geokit gem provides:

  • Distance calculations between two points on the earth. Calculate the distance in miles, kilometers, meters, or nautical miles, with all the trigonometry abstracted away by Geokit.
  • Geocoding from multiple providers. It supports Google, Yahoo, and Geocoder.ca geocoders, and others. It provides a uniform response structure from all of them. It also provides a fail-over mechanism, in case your input fails to geocode in one service.
  • Rectangular bounds calculations: is a point within a given rectangular bounds?
  • Heading and midpoint calculations

Combine this gem with the geokit-rails to get location-based finders for your Rails app.

COMMUNICATION

  • If you need help, use Stack Overflow. (Tag 'geokit' and we'll be alerted)
  • If you found a bug, use GitHub issues.
  • If you have an idea, use GitHub issues.
  • If you'd like to ask a general question, use GitHub issues.
  • If you want to contribute, submit a pull request.

INSTALL

gem install geokit

SUPPORTED GEOCODERS

"regular" address geocoders

  • Yahoo BOSS - requires an API key.
  • Geocoder.ca - for Canada; may require authentication as well.
  • Geonames - a free geocoder
  • Bing
  • Yandex
  • MapQuest
  • Geocod.io
  • OpenStreetMap (Nominatim)
  • Mapbox - requires an access token
  • OpenCage - requires an API key

address geocoders that also provide reverse geocoding

  • Google - Supports multiple results and bounding box/country code biasing. Also supports Maps API for Business keys; see the configuration section below.
  • FCC
  • OpenStreetMap (Nominatim)
  • Mapbox
  • OpenCage

IP address geocoders

  • IP - geocodes an IP address using hostip.info's web service.
  • Geoplugin.net -- another IP address geocoder
  • RIPE
  • MaxMind
  • Ipstack
  • IP-API.com

HTTPS-supporting geocoders

  • Google
  • Yahoo
  • Bing
  • FCC
  • MapQuest
  • Mapbox
  • OpenCage

Options to control the use of HTTPS are described below in the Configuration section.

QUICK START

    irb> require 'rubygems'
    irb> require 'geokit'
    irb> a=Geokit::Geocoders::GoogleGeocoder.geocode '140 Market St, San Francisco, CA'
    irb> a.ll
     => 37.79363,-122.396116
    irb> b=Geokit::Geocoders::GoogleGeocoder.geocode '789 Geary St, San Francisco, CA'
    irb> b.ll
     => 37.786217,-122.41619
    irb> a.distance_to(b)
     => 1.21120007413626
    irb> a.heading_to(b)
    => 244.959832435678
    irb(main):006:0> c=a.midpoint_to(b)      # what's halfway from a to b?
    irb> c.ll
    => "37.7899239257175,-122.406153503469"
    irb(main):008:0> d=c.endpoint(90,10)     # what's 10 miles to the east of c?
    irb> d.ll
    => "37.7897825005142,-122.223214776155"

FYI, that .ll method means "latitude longitude".

See the RDOC more more ... there are also operations on rectangular bounds (e.g., determining if a point is within bounds, find the center, etc).

CONFIGURATION

If you're using this gem by itself, here are the configuration options:

    # These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
    Geokit::default_units = :miles # others :kms, :nms, :meters
    Geokit::default_formula = :sphere

    # This is the timeout value in seconds to be used for calls to the geocoder web
    # services.  For no timeout at all, comment out the setting.  The timeout unit
    # is in seconds.
    Geokit::Geocoders::request_timeout = 3

    # This setting can be used if web service calls must be routed through a proxy.
    # These setting can be nil if not needed, otherwise, a valid URI must be
    # filled in at a minimum.  If the proxy requires authentication, the username
    # and password can be provided as well.
    Geokit::Geocoders::proxy = 'https://user:password@host:port'

    # This setting can be used if a web service blocks requests by certain user agents.
    # If not set Geokit uses the default useragent header set by the different net adapter libs.
    Geokit::Geocoders::useragent = 'my agent string'

    # This is your yahoo application key for the Yahoo Geocoder.
    # See http://developer.yahoo.com/faq/index.html#appid
    # and http://developer.yahoo.com/maps/rest/V1/geocode.html
    Geokit::Geocoders::YahooGeocoder.key = 'REPLACE_WITH_YOUR_YAHOO_KEY'
    Geokit::Geocoders::YahooGeocoder.secret = 'REPLACE_WITH_YOUR_YAHOO_SECRET'

    # This is your Google Maps geocoder keys (all optional).
    # See http://www.google.com/apis/maps/signup.html
    # and http://www.google.com/apis/maps/documentation/#Geocoding_Examples
    Geokit::Geocoders::GoogleGeocoder.client_id = ''
    Geokit::Geocoders::GoogleGeocoder.cryptographic_key = ''
    Geokit::Geocoders::GoogleGeocoder.channel = ''

    # You can also use the free API key instead of signed requests
    # See https://developers.google.com/maps/documentation/geocoding/#api_key
    Geokit::Geocoders::GoogleGeocoder.api_key = ''

    # You can also set multiple API KEYS for different domains that may be directed to this same application.
    # The domain from which the current user is being directed will automatically be updated for Geokit via
    # the GeocoderControl class, which gets it's begin filter mixed into the ActionController.
    # You define these keys with a Hash as follows:
    #Geokit::Geocoders::google = { 'rubyonrails.org' => 'RUBY_ON_RAILS_API_KEY', 'ruby-docs.org' => 'RUBY_DOCS_API_KEY' }

    # This is your authorization key for geocoder.ca.
    # To use the free service, the value can be set to nil or false.  For
    # usage tied to an account, set the value to the key obtained from
    # Geocoder.ca.
    # See http://geocoder.ca
    # and http://geocoder.ca/?register=1
    Geokit::Geocoders::CaGeocoder.key = 'KEY'

    # This is your username key for geonames.
    # To use this service either free or premium, you must register a key.
    # See http://www.geonames.org
    Geokit::Geocoders::GeonamesGeocoder.key = 'KEY'

    # This is your access key for ipstack.
    # To use this service either free or premium, you must register a key.
    # See https://ipstack.com
    Geokit::Geocoders::IpstackGeocoder.api_key = 'API_KEY'

    # This is your api key for ip-api.com.
    # For the free version (with rate limits), leave api_key unset.
    # See https://ip-api.com/
    Geokit::Geocoders::IpApiGeocoder.key = ''

    # Most other geocoders need either no setup or a key
    Geokit::Geocoders::BingGeocoder.key = ''
    Geokit::Geocoders::MapQuestGeocoder.key = ''
    Geokit::Geocoders::YandexGeocoder.key = ''
    Geokit::Geocoders::MapboxGeocoder.key = 'ACCESS_TOKEN'
    Geokit::Geocoders::OpencageGeocoder.key = 'some_api_key'

    # Geonames has a free service and a premium service, each using a different URL
    # GeonamesGeocoder.premium = true will use http://ws.geonames.net (premium)
    # GeonamesGeocoder.premium = false will use http://api.geonames.org (free)
    Geokit::Geocoders::GeonamesGeocoder.premium = false

    # require "external_geocoder.rb"
    # Please see the section "writing your own geocoders" for more information.
    # Geokit::Geocoders::external_key = 'REPLACE_WITH_YOUR_API_KEY'

    # This is the order in which the geocoders are called in a failover scenario
    # If you only want to use a single geocoder, put a single symbol in the array.
    #
    # Valid symbols are: :bing, :ca, :fcc, :geocodio, :geonames, :google,
    # :map_quest, :mapbox, :maxmind, :opencage, :osm, :us, :yahoo, and :yandex.
    #
    # Be aware that there are Terms of Use restrictions on how you can use the
    # various geocoders.  Make sure you read up on relevant Terms of Use for each
    # geocoder you are going to use.
    Geokit::Geocoders::provider_order = [:google,:us]

    # The IP provider order.
    #
    # Valid symbols are :ipstack, :geo_plugin, :ip, and :ripe.
    #
    # As before, make sure you read up on relevant Terms of Use for each.
    # Geokit::Geocoders::ip_provider_order = [:external,:geo_plugin,:ip]

	# Disable HTTPS globally.  This option can also be set on individual
	# geocoder classes.
    Geokit::Geocoders::secure = false

    # Control verification of the server certificate for geocoders using HTTPS
    Geokit::Geocoders::ssl_verify_mode = OpenSSL::SSL::VERIFY_(PEER/NONE)
    # Setting this to VERIFY_NONE may be needed on systems that don't have
    # a complete or up to date root certificate store. Only applies to
    # the Net::HTTP adapter.

Google Geocoder Tricks

The Google Geocoder sports a number of useful tricks that elevate it a little bit above the rest of the currently supported geocoders. For starters, it returns a suggested_bounds property for all your geocoded results, so you can more easily decide where and how to center a map on the places you geocode. Here's a quick example:

    irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('140 Market St, San Francisco, CA')
    irb> pp res.suggested_bounds
    #<Geokit::Bounds:0x53b36c
     @ne=#<Geokit::LatLng:0x53b204 @lat=37.7968528, @lng=-122.3926933>,
     @sw=#<Geokit::LatLng:0x53b2b8 @lat=37.7905576, @lng=-122.3989885>>

In addition, you can use viewport or country code biasing to make sure the geocoders prefers results within a specific area. Say we wanted to geocode the city of Toledo in Spain. A normal geocoding query would look like this:

    irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('Toledo')
    irb> res.full_address
    => "Toledo, OH, USA"

Not exactly what we were looking for. We know that Toledo is in Spain, so we can tell the Google Geocoder to prefer results from Spain first, and then wander the Toledos of the world. To do that, we have to pass Spain's ccTLD (country code top-level domain) to the :bias option of the geocode method. You can find a comprehensive list of all ccTLDs here: http://en.wikipedia.org/wiki/CcTLD.

    irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('Toledo', :bias => 'es')
    irb> res.full_address
    => "Toledo, Toledo, Spain"

Alternatively, we can specify the geocoding bias as a bounding box object. Say we wanted to geocode the Winnetka district in Los Angeles.

    irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('Winnetka')
    irb> res.full_address
    => "Winnetka, IL, USA"

Not it. What we can do is tell the geocoder to return results only from in and around LA.

    irb> la_bounds = Geokit::Geocoders::GoogleGeocoder.geocode('Los Angeles').suggested_bounds
    irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('Winnetka', :bias => la_bounds)
    irb> res.full_address
    => "Winnetka, California, USA"

Another option is to use Component Filtering as described at https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering. To do that supply the :components option to the geocode method. This option should be a hash with keys corresponding to desired component names.

Suppose we'd like to geocode string 'Austin'. Regularly, Google would return 'Austin, TX, USA' for such a query. Not with component filtering:

    irb>res = Geokit::Geocoders::GoogleGeocoder.geocode("austin", components: { administrative_area: 'IL', country: 'US' })
    irb>res.full_address
    => "Austin, Chicago, IL, USA"

The Multigeocoder

Multi Geocoder - provides failover for the physical location geocoders, and also IP address geocoders. Its configured by setting Geokit::Geocoders::provider_order, and Geokit::Geocoders::ip_provider_order. You should call the Multi-Geocoder with its :geocode method, supplying one address parameter which is either a real street address, or an ip address. For example:

    Geokit::Geocoders::MultiGeocoder.geocode("900 Sycamore Drive")

    Geokit::Geocoders::MultiGeocoder.geocode("12.12.12.12")

    Geokit::Geocoders::MultiGeocoder.geocode("Hamburg, Germany", :provider_order => [:osm, :mapbox, :google])

MULTIPLE RESULTS

Some geocoding services will return multiple results if the there isn't one clear result. Geoloc can capture multiple results through its "all" method.

    irb> geo=Geokit::Geocoders::GoogleGeocoder.geocode("900 Sycamore Drive")
    irb> geo.full_address
    => "900 Sycamore Dr, Arkadelphia, AR 71923, USA"
    irb> geo.all.size
    irb> geo.all.each { |e| puts e.full_address }
    900 Sycamore Dr, Arkadelphia, AR 71923, USA
    900 Sycamore Dr, Burkburnett, TX 76354, USA
    900 Sycamore Dr, TN 38361, USA
    ....

geo.all is just an array of additional Geolocs, so do what you want with it. If you call .all on a geoloc that doesn't have any additional results, you will get an array of one.

NOTES ON WHAT'S WHERE

mappable.rb contains the Mappable module, which provides basic distance calculation methods, i.e., calculating the distance between two points.

LatLng is a simple container for latitude and longitude, but it's made more powerful by mixing in the above-mentioned Mappable module -- therefore, you can calculate easily the distance between two LatLng objects with distance = first.distance_to(other)

GeoLoc represents an address or location which has been geocoded. You can get the city, zipcode, street address, etc. from a GeoLoc object. GeoLoc extends LatLng, so you also get lat/lng AND the Mappable module goodness for free.

geocoders.rb contains all the geocoder implementations. All the geocoders inherit from a common base (class Geocoder) and implement the private method do_geocode.

WRITING YOUR OWN GEOCODERS

If you would like to write your own geocoders, you can do so by requiring 'geokit' or 'geokit/geocoders.rb' in a new file and subclassing the base class (which is class "Geocoder"). You must then also require such external file back in your main geokit configuration.

  require "geokit"

  module Geokit
    module Geocoders

      # and use :my to specify this geocoder in your list of geocoders.
      class MyGeocoder < Geocoder

        # Use via: Geokit::Geocoders::MyGeocoder.key = 'MY KEY'
        config :key

        private

        def self.do_geocode(address, options = {})
          # Main geocoding method
        end

        def self.parse_json(json)
          # Helper method to parse http response. See geokit/geocoders.rb.
        end
      end

    end
  end

geokit-rails3's People

Contributors

albanpeignier avatar brennandunn avatar dreamcat4 avatar glennpow avatar gustin avatar jlecour avatar josevalim avatar mischa avatar mnoack avatar monde avatar pex avatar pklingem avatar sionide21 avatar wspruijt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geokit-rails3's Issues

Column "distance" does not exist when using Model.where

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!

Unknow column distance

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

Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT

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:ingeocode'
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:instart'
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:inrequire'
from script/rails:6:in `

'

undefined method `empty?' for #<Geokit::GeoLoc:0x45ef820>

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

.app/controllers/mymodel_controller.rb:19:in 'create'

..
..

Could somebody help me?

Distance sorting takes no effect.

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?

No generator for geokit:install

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.

Suggestion:

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.

includes not taken into account

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.

Unknown key(s): origin

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 :)

undefined method `acts_as_mappable'

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.

url_escape not working well for umlaut characters

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

Geokit::ActsAsMappable::UnsupportedAdapter `mysql2` is not a supported adapter.

Geokit::ActsAsMappable::UnsupportedAdapter

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.

Gems:

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)

Stacktrace:

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

'`

Update to Geokit 1.7

Attempting to run with the current version of Geokit (1.7.1) results in: uninitialized constant Geokit::Railtie::GeoKit (NameError).

Can't install to Rails 3.1

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'?

mutated vowel

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

Math::DomainError

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'

doesn't work with scopes

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.