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) {
12
12
for (size_t i = 0 ; i < g.size (); i++) {
13
13
if (g[i]->getDimension () == 2 ) {
14
14
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
16
17
OGRGeometryCollection *gc = (OGRGeometryCollection *) g[i];
17
18
out[i] = gc->get_Area ();
18
- } else {
19
+ } else if ( OGR_GT_IsSurface (gt)) {
19
20
OGRSurface *surf = (OGRSurface *) g[i];
20
21
out[i] = surf->get_Area ();
21
- }
22
+ } else {
23
+ out[i] = 0.0 ; // not supposed to happen, but who knows...
24
+ }
22
25
} else
23
26
out[i] = 0.0 ;
24
27
OGRGeometryFactory::destroyGeometry (g[i]);
You can’t perform that action at this time.
0 commit comments