Class: Underpass::Feature
- Inherits:
-
Object
- Object
- Underpass::Feature
- Defined in:
- lib/underpass/feature.rb
Overview
Wraps an RGeo geometry with OSM metadata (tags, id, type).
Returned by QL::Query.perform and Matcher#matches for each matched element in the Overpass API response.
Instance Attribute Summary collapse
-
#geometry ⇒ RGeo::Feature::Geometry
readonly
The RGeo geometry object.
-
#id ⇒ Integer?
readonly
The OSM element ID.
-
#properties ⇒ Hash{Symbol => String}
readonly
The OSM tags for this element.
-
#type ⇒ String?
readonly
The OSM element type (“node”, “way”, or “relation”).
Instance Method Summary collapse
-
#initialize(geometry:, properties: {}, id: nil, type: nil) ⇒ Feature
constructor
Creates a new Feature.
Constructor Details
#initialize(geometry:, properties: {}, id: nil, type: nil) ⇒ Feature
Creates a new Feature.
27 28 29 30 31 32 |
# File 'lib/underpass/feature.rb', line 27 def initialize(geometry:, properties: {}, id: nil, type: nil) @geometry = geometry @properties = properties @id = id @type = type end |
Instance Attribute Details
#geometry ⇒ RGeo::Feature::Geometry (readonly)
Returns the RGeo geometry object.
10 11 12 |
# File 'lib/underpass/feature.rb', line 10 def geometry @geometry end |
#id ⇒ Integer? (readonly)
Returns the OSM element ID.
16 17 18 |
# File 'lib/underpass/feature.rb', line 16 def id @id end |
#properties ⇒ Hash{Symbol => String} (readonly)
Returns the OSM tags for this element.
13 14 15 |
# File 'lib/underpass/feature.rb', line 13 def properties @properties end |
#type ⇒ String? (readonly)
Returns the OSM element type (“node”, “way”, or “relation”).
19 20 21 |
# File 'lib/underpass/feature.rb', line 19 def type @type end |