File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,16 @@ Rcpp::NumericVector CPL_area(Rcpp::List sfc) {
1212 for (size_t i = 0 ; i < g.size (); i++) {
1313 if (g[i]->getDimension () == 2 ) {
1414 OGRwkbGeometryType gt = OGR_GT_Flatten (g[i]->getGeometryType ());
15- if (gt == wkbMultiSurface || gt == wkbMultiPolygon) {
15+ if (OGR_GT_IsSubClassOf (gt, wkbGeometryCollection)) {
16+ // will match OGRMultiPolygon, OGRMultiSurface and OGRGeometryCollection
1617 OGRGeometryCollection *gc = (OGRGeometryCollection *) g[i];
1718 out[i] = gc->get_Area ();
18- } else {
19+ } else if ( OGR_GT_IsSurface (gt)) {
1920 OGRSurface *surf = (OGRSurface *) g[i];
2021 out[i] = surf->get_Area ();
21- }
22+ } else {
23+ out[i] = 0.0 ; // not supposed to happen, but who knows...
24+ }
2225 } else
2326 out[i] = 0.0 ;
2427 OGRGeometryFactory::destroyGeometry (g[i]);
You can’t perform that action at this time.
0 commit comments