Class | Geokit::GeoLoc |
In: |
lib/geokit/mappable.rb
|
Parent: | LatLng |
This class encapsulates the result of a geocoding call. It‘s primary purpose is to homogenize the results of multiple geocoding providers. It also provides some additional functionality, such as the "full address" method for geocoders that do not provide a full address in their results (for example, Yahoo), and the "is_us" method.
Some geocoders can return multple results. Geoloc can capture multiple results through its "all" method.
For the geocoder setting the results, it would look something like this:
geo=GeoLoc.new(first_result) geo.all.push(second_result) geo.all.push(third_result)
Then, for the user of the result:
puts geo.full_address # just like usual puts geo.all.size => 3 # there's three results total puts geo.all.first # all is just an array or additional geolocs, so do what you want with it
accuracy | [RW] | accuracy is set for Yahoo and Google geocoders, it is a numeric value of the precision. see code.google.com/apis/maps/documentation/geocoding/#GeocodingAccuracy |
all | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
city | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
country | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
country_code | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
district | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
full_address | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
precision | [RW] | Attributes set upon return from geocoding. Success will be true for successful geocode lookups. The provider will be set to the name of the providing geocoder. Finally, precision is an indicator of the accuracy of the geocoding. |
provider | [RW] | Attributes set upon return from geocoding. Success will be true for successful geocode lookups. The provider will be set to the name of the providing geocoder. Finally, precision is an indicator of the accuracy of the geocoding. |
province | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
state | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
street_address | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
street_name | [R] | Street number and street name are extracted from the street address attribute. |
street_number | [R] | Street number and street name are extracted from the street address attribute. |
success | [RW] | Attributes set upon return from geocoding. Success will be true for successful geocode lookups. The provider will be set to the name of the providing geocoder. Finally, precision is an indicator of the accuracy of the geocoding. |
suggested_bounds | [RW] | Attributes set upon return from geocoding. Success will be true for successful geocode lookups. The provider will be set to the name of the providing geocoder. Finally, precision is an indicator of the accuracy of the geocoding. |
zip | [RW] | Location attributes. Full address is a concatenation of all values. For example: 100 Spear St, San Francisco, CA, 94101, US |
full_address is provided by google but not by yahoo. It is intended that the google geocoding method will provide the full address, whereas for yahoo it will be derived from the parts of the address we do have.