Class: Geos::MultiPolygon
- Inherits:
-
GeometryCollection
- Object
- GeometryCollection
- Geos::MultiPolygon
- Defined in:
- lib/geos/multi_polygon.rb
Instance Method Summary collapse
- #to_geojsonable(options = {}) ⇒ Object (also: #as_geojson)
Methods inherited from GeometryCollection
#[], #as_json, #each, #last, #to_georss, #to_kml
Instance Method Details
#to_geojsonable(options = {}) ⇒ Object Also known as: as_geojson
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/geos/multi_polygon.rb', line 4 def to_geojsonable( = {}) = { :interior_rings => true }.merge() { :type => 'MultiPolygon', :coordinates => self.to_a.collect { |polygon| coords = [ polygon.exterior_ring.coord_seq.to_a ] if [:interior_rings] && polygon.num_interior_rings > 0 coords.concat polygon.interior_rings.collect { |r| r.coord_seq.to_a } end coords } } end |