class Nominatim::Place

Public Class Methods

new(attrs = {}) click to toggle source

attr_reader :attrs alias to_hash attrs

# File lib/nominatim/place.rb, line 6
def initialize(attrs = {})
  @attrs = attrs
end

Public Instance Methods

address() click to toggle source

Return an address

@return [Nominatim::Address]

# File lib/nominatim/place.rb, line 34
def address
  @address ||= Nominatim::Address.new(@attrs[:address]) if @attrs[:address]
end
bounding_box()
Alias for: boundingbox
boundingbox() click to toggle source
# File lib/nominatim/place.rb, line 54
def boundingbox
  @boundingbox ||= @attrs[:boundingbox]
end
Also aliased as: bounding_box
class() click to toggle source

Return a class

@return [String]

# File lib/nominatim/place.rb, line 20
def class
  @class ||= @attrs[:class]
end
display_name() click to toggle source

Return display name

@return [String]

# File lib/nominatim/place.rb, line 13
def display_name
  @display_name ||= @attrs[:display_name]
end
lat() click to toggle source

Return a latitude

@return [Float]

# File lib/nominatim/place.rb, line 41
def lat
  point.lat
end
Also aliased as: latitude
latitude()
Alias for: lat
lon() click to toggle source

Return a longitude

@return [Float]

# File lib/nominatim/place.rb, line 49
def lon
  point.lon
end
Also aliased as: longitude
longitude()
Alias for: lon
osm_id() click to toggle source

Return an OSM id

@return [Integer]

# File lib/nominatim/place.rb, line 76
def osm_id
  @osm_id ||= @attrs[:osm_id].to_i if @attrs[:osm_id]
end
osm_type() click to toggle source

Return an OSM type

@return [String]

# File lib/nominatim/place.rb, line 83
def osm_type
  @osm_type ||= @attrs[:osm_type]
end
place_id() click to toggle source

Return a place id

@return [Integer]

# File lib/nominatim/place.rb, line 69
def place_id
  @place_id ||= @attrs[:place_id].to_i if @attrs[:place_id]
end
polygonpoints() click to toggle source

Return a polygon

@return [Nominatim::Polygon]

# File lib/nominatim/place.rb, line 62
def polygonpoints
  @polygonpoints ||= Nominatim::Polygon.new(@attrs[:polygonpoints]) if @attrs[:polygonpoints]
end
type() click to toggle source

Return a type

@return [String]

# File lib/nominatim/place.rb, line 27
def type
  @type ||= @attrs[:type]
end

Private Instance Methods

point() click to toggle source
# File lib/nominatim/place.rb, line 89
def point
  @point ||= Nominatim::Point.new(@attrs[:lat], @attrs[:lon])
end