Class: Nominatim::Place
- Inherits:
-
Object
- Object
- Nominatim::Place
- Defined in:
- lib/nominatim/place.rb
Instance Method Summary collapse
-
#address ⇒ Nominatim::Address
Return an address.
- #boundingbox ⇒ Object (also: #bounding_box)
-
#class ⇒ String
Return a class.
-
#display_name ⇒ String
Return display name.
-
#initialize(attrs = {}) ⇒ Place
constructor
attr_reader :attrs alias to_hash attrs.
-
#lat ⇒ Float
(also: #latitude)
Return a latitude.
-
#lon ⇒ Float
(also: #longitude)
Return a longitude.
-
#osm_id ⇒ Integer
Return an OSM id.
-
#osm_type ⇒ String
Return an OSM type.
-
#place_id ⇒ Integer
Return a place id.
-
#polygonpoints ⇒ Nominatim::Polygon
Return a polygon.
-
#type ⇒ String
Return a type.
Constructor Details
#initialize(attrs = {}) ⇒ Place
attr_reader :attrs alias to_hash attrs
6 7 8 |
# File 'lib/nominatim/place.rb', line 6 def initialize(attrs = {}) @attrs = attrs end |
Instance Method Details
#address ⇒ Nominatim::Address
Return an address
34 35 36 |
# File 'lib/nominatim/place.rb', line 34 def address @address ||= Nominatim::Address.new(@attrs[:address]) if @attrs[:address] end |
#boundingbox ⇒ Object Also known as: bounding_box
54 55 56 |
# File 'lib/nominatim/place.rb', line 54 def boundingbox @boundingbox ||= @attrs[:boundingbox] end |
#class ⇒ String
Return a class
20 21 22 |
# File 'lib/nominatim/place.rb', line 20 def class @class ||= @attrs[:class] end |
#display_name ⇒ String
Return display name
13 14 15 |
# File 'lib/nominatim/place.rb', line 13 def display_name @display_name ||= @attrs[:display_name] end |
#lat ⇒ Float Also known as: latitude
Return a latitude
41 42 43 |
# File 'lib/nominatim/place.rb', line 41 def lat point.lat end |
#lon ⇒ Float Also known as: longitude
Return a longitude
49 50 51 |
# File 'lib/nominatim/place.rb', line 49 def lon point.lon end |
#osm_id ⇒ Integer
Return an OSM id
76 77 78 |
# File 'lib/nominatim/place.rb', line 76 def osm_id @osm_id ||= @attrs[:osm_id].to_i if @attrs[:osm_id] end |
#osm_type ⇒ String
Return an OSM type
83 84 85 |
# File 'lib/nominatim/place.rb', line 83 def osm_type @osm_type ||= @attrs[:osm_type] end |
#place_id ⇒ Integer
Return a place id
69 70 71 |
# File 'lib/nominatim/place.rb', line 69 def place_id @place_id ||= @attrs[:place_id].to_i if @attrs[:place_id] end |
#polygonpoints ⇒ Nominatim::Polygon
Return a polygon
62 63 64 |
# File 'lib/nominatim/place.rb', line 62 def polygonpoints @polygonpoints ||= Nominatim::Polygon.new(@attrs[:polygonpoints]) if @attrs[:polygonpoints] end |
#type ⇒ String
Return a type
27 28 29 |
# File 'lib/nominatim/place.rb', line 27 def type @type ||= @attrs[:type] end |