class GeoRb::Location

Contains a parsed geocoder response. Can be iterated over as “(location<String>, (latitude<float>, longitude<Float))“.

Or one can access the properties ``address``, ``latitude``,
``longitude``, or ``raw``. The last
is a dictionary of the geocoder's response for this item.

Attributes

address[R]
point[R]
raw[R]

Public Class Methods

lookup(text, adapter: GeoRb::GeoCoders::Nominatim, **options) click to toggle source
# File lib/geo_rb/location.rb, line 14
def self.lookup(text, adapter: GeoRb::GeoCoders::Nominatim, **options)
  adapter.new.geocode(text, **options)
end
new(address:, raw:, point: Point) click to toggle source
# File lib/geo_rb/location.rb, line 18
def initialize(address:, raw:, point: Point)
  @address = address
  @point = point
  @raw = raw
end

Public Instance Methods

distance_to(location) click to toggle source
# File lib/geo_rb/location.rb, line 24
def distance_to(location)
  Distance.new(self, location)
end
to_h() click to toggle source
# File lib/geo_rb/location.rb, line 28
def to_h
  {address: address}.merge(point.to_h)
end