Method: RGeo::Geos::CAPIGeometryMethods#polygonize

Defined in:
ext/geos_c_impl/geometry.c

#polygonizeRGeo::Feature::GeometryCollection

Polygonizes a set of Geometries which contain linework that represents the edges of a planar graph.

All types of Geometry are accepted as input; the constituent linework is extracted as the edges to be polygonized.

The edges must be correctly noded; that is, they must only meet at their endpoints and not overlap anywhere.

libgeos.org/doxygen/geos__c_8h.html#a9d98e448d3b846d591c726d1c0000d25 GEOSPolygonize

See Also:



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
# File 'ext/geos_c_impl/geometry.c', line 1189

static VALUE
method_geometry_polygonize(VALUE self)
{
  VALUE result;
  RGeo_GeometryData* self_data;
  const GEOSGeometry* self_geom;
  GEOSGeometry* geos_polygon_collection;

  result = Qnil;
  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  self_geom = self_data->geom;
  if (self_geom) {
    geos_polygon_collection = GEOSPolygonize(&self_geom, 1);

    if (geos_polygon_collection == NULL) {
      rb_raise(rb_eGeosError, "GEOS can't polygonize this geometry.");
    }

    result = rgeo_wrap_geos_geometry(
      self_data->factory, geos_polygon_collection, Qnil);
  }
  return result;
}