Class: NSWTopo::GeoJSON::Polygon
- Inherits:
-
Object
- Object
- NSWTopo::GeoJSON::Polygon
- Defined in:
- lib/nswtopo/gis/geojson/polygon.rb
Instance Method Summary collapse
Instance Method Details
#bounds ⇒ Object
13 14 15 |
# File 'lib/nswtopo/gis/geojson/polygon.rb', line 13 def bounds @coordinates.first.transpose.map(&:minmax) end |
#validate! ⇒ Object
6 7 8 9 10 11 |
# File 'lib/nswtopo/gis/geojson/polygon.rb', line 6 def validate! @coordinates.inject(false) do |hole, ring| ring.reverse! if hole ^ ring.hole? true end end |
#wkt ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/nswtopo/gis/geojson/polygon.rb', line 17 def wkt @coordinates.map do |ring| ring.map do |point| point.join(" ") end.join(", ").prepend("(").concat(")") end.join(", ").prepend("POLYGON (").concat(")") end |