Module: Geokit::Geocoders

Defined in:
lib/geokit/geocoders.rb,
lib/geokit/geocoders/ip.rb,
lib/geokit/geocoders/fcc.rb,
lib/geokit/geocoders/bing.rb,
lib/geokit/geocoders/ripe.rb,
lib/geokit/multi_geocoder.rb,
lib/geokit/geocoders/yahoo.rb,
lib/geokit/geocoders/google.rb,
lib/geokit/geocoders/mapbox.rb,
lib/geokit/geocoders/yandex.rb,
lib/geokit/geocoders/base_ip.rb,
lib/geokit/geocoders/ipstack.rb,
lib/geokit/geocoders/maxmind.rb,
lib/geokit/geocoders/geobytes.rb,
lib/geokit/geocoders/geocodio.rb,
lib/geokit/geocoders/geonames.rb,
lib/geokit/geocoders/mapquest.rb,
lib/geokit/geocoders/opencage.rb,
lib/geokit/geocoders/geo_plugin.rb,
lib/geokit/geocoders/ca_geocoder.rb,
lib/geokit/geocoders/us_geocoder.rb,
lib/geokit/geocoders/openstreetmap.rb,
lib/geokit/geocoders/ip_api_geocoder.rb

Overview

Contains a range of geocoders:

### “regular” address geocoders

  • Yahoo Geocoder - requires an API key.

  • Geocoder.us - may require authentication if performing more than the free request limit.

  • Geocoder.ca - for Canada; may require authentication as well.

  • Geonames - a free geocoder

### address geocoders that also provide reverse geocoding

  • Google Geocoder - requires an API key.

### IP address geocoders

  • IP Geocoder - geocodes an IP address using hostip.info's web service.

  • Geoplugin.net – another IP address geocoder

  • IP-API.com – another IP address geocoder

### The Multigeocoder

  • Multi Geocoder - provides failover for the physical location geocoders.

Some of these geocoders require configuration. You don't have to provide it here. See the README.

Defined Under Namespace

Classes: AccessDeniedError, BaseIpGeocoder, BingGeocoder, CaGeocoder, FCCGeocoder, GeoPluginGeocoder, GeobytesGeocoder, GeocodeError, Geocoder, GeocodioGeocoder, GeonamesGeocoder, GoogleGeocoder, IpApiGeocoder, IpGeocoder, IpstackGeocoder, MapQuestGeocoder, MapboxGeocoder, MaxmindGeocoder, MultiGeocoder, OSMGeocoder, OpencageGeocoder, RipeGeocoder, TooManyQueriesError, UsGeocoder, YahooGeocoder, YandexGeocoder

Constant Summary collapse

OsmGeocoder =
Geokit::Geocoders::OSMGeocoder
@@proxy =
nil
@@useragent =
nil
@@request_timeout =
nil
@@provider_order =
[:google, :us]
@@ip_provider_order =
[:geo_plugin, :ip]
@@logger =
Logger.new(STDOUT)
@@host =
nil
@@domain =
nil
@@net_adapter =
Geokit::NetAdapter::NetHttp
@@secure =
true
@@ssl_verify_mode =
OpenSSL::SSL::VERIFY_PEER

Class Method Summary collapse

Class Method Details

.__define_accessorsObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/geokit/geocoders.rb', line 49

def self.__define_accessors
  class_variables.each do |v|
    sym = v.to_s.delete('@').to_sym
    next if self.respond_to? sym
    module_eval "def self.\#{sym}\nvalue = if defined?(\#{sym.to_s.upcase})\n\#{sym.to_s.upcase}\nelse\n@@\#{sym}\nend\nif value.is_a?(Hash)\nvalue = (self.domain.nil? ? nil : value[self.domain]) || value.values.first\nend\nvalue\nend\n\ndef self.\#{sym}=(obj)\n@@\#{sym} = obj\nend\n", __FILE__, __LINE__
  end
end