Module: Geokit::Geocoders
- Defined in:
- lib/geokit/geocoders.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
### 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: CaGeocoder, GeoPluginGeocoder, GeocodeError, Geocoder, GeonamesGeocoder, GoogleGeocoder, IpGeocoder, MultiGeocoder, UsGeocoder, YahooGeocoder
Constant Summary collapse
- @@proxy_addr =
nil- @@proxy_port =
nil- @@proxy_user =
nil- @@proxy_pass =
nil- @@timeout =
nil- @@yahoo =
'REPLACE_WITH_YOUR_YAHOO_KEY'- @@google =
'REPLACE_WITH_YOUR_GOOGLE_KEY'- @@geocoder_us =
false- @@geocoder_ca =
false- @@geonames =
false- @@provider_order =
[:google,:us]
- @@ip_provider_order =
[:geo_plugin,:ip]
- @@logger =
Logger.new(STDOUT)
- @@domain =
nil
Class Method Summary collapse
Class Method Details
.__define_accessors ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/geokit/geocoders.rb', line 82 def self.__define_accessors class_variables.each do |v| sym = v.to_s.delete("@").to_sym unless self.respond_to? sym module_eval " def self.\#{sym}\n value = if defined?(\#{sym.to_s.upcase})\n \#{sym.to_s.upcase}\n else\n @@\#{sym}\n end\n if value.is_a?(Hash)\n value = (self.domain.nil? ? nil : value[self.domain]) || value.values.first\n end\n value\n end\n \n def self.\#{sym}=(obj)\n @@\#{sym} = obj\n end\n EOS\n end\n end\nend\n", __FILE__, __LINE__ |