Class: MapnikLegendary::Part
- Inherits:
-
Object
- Object
- MapnikLegendary::Part
- Defined in:
- lib/mapnik_legendary/part.rb
Overview
A part is a combination of tags, geometry and layers.
Instance Attribute Summary collapse
-
#geom ⇒ Object
readonly
Returns the value of attribute geom.
-
#layers ⇒ Object
readonly
Returns the value of attribute layers.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(h, zoom, map, extra_tags) ⇒ Part
constructor
A new instance of Part.
- #to_csv ⇒ Object
Constructor Details
#initialize(h, zoom, map, extra_tags) ⇒ Part
Returns a new instance of Part.
11 12 13 14 15 16 17 18 19 |
# File 'lib/mapnik_legendary/part.rb', line 11 def initialize(h, zoom, map, ) = Tags.merge_nulls(h['tags'], ) @geom = Geometry.new(h['type'], zoom, map) if h['layer'] @layers = [h['layer']] else @layers = h['layers'] end end |
Instance Attribute Details
#geom ⇒ Object (readonly)
Returns the value of attribute geom.
9 10 11 |
# File 'lib/mapnik_legendary/part.rb', line 9 def geom @geom end |
#layers ⇒ Object (readonly)
Returns the value of attribute layers.
9 10 11 |
# File 'lib/mapnik_legendary/part.rb', line 9 def layers @layers end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
9 10 11 |
# File 'lib/mapnik_legendary/part.rb', line 9 def end |
Instance Method Details
#to_csv ⇒ Object
21 22 23 24 25 |
# File 'lib/mapnik_legendary/part.rb', line 21 def to_csv csv = '' csv << .keys.push('wkt').join(',') + "\n" csv << .values.push(@geom.to_csv).join(',') + "\n" end |