Opened 8 years ago
Closed 8 years ago
#6494 closed defect (fixed)
Layer intersection, Union and Identity are inconsistent about skipping lower dimension result features
Reported by: | Ari Jolma | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
In r25427 a check was added to skip result features with linestrings and points if input features are polygons. However, If input features are linestrings point results are not skipped.
Skipping features with lower dimension geometries is often good since not doing so may result in error since many formats do not support mixing geometry types. However, sometimes skipping is not desired and it can be argued that it is against the formal definition of intersection.
A solution is to add option KEEP_LOWER_DIMENSION_GEOMETRIES to control the skipping. Since the current behavior is inconsistent, adding the option will break some possibly existing code whatever we set the default. I propose to set the default to YES and within the methods set it to NO unless the target geometry type is unknown (supports mixed types). The check should be changed to
z_geom->IsEmpty() || (!bKeepLowerDimGeom && (x_geom->getDimension() == y_geom->getDimension() && z_geom->getDimension() < x_geom->getDimension())))
Fixed in r34148.