Skip to content

Commit 82894b6

Browse files

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/core/qgsgeometry.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4583,10 +4583,16 @@ int QgsGeometry::splitPolygonGeometry(GEOS_GEOM::LineString* splitLine, QList<Qg
45834583
//include in result if yes
45844584
QList<GEOS_GEOM::Geometry*> testedGeometries;
45854585
GEOS_GEOM::Geometry* intersectGeometry = 0;
4586+
4587+
//ratio intersect geometry / geometry. This should be close to 1
4588+
//if the polygon belongs to the input geometry
4589+
4590+
double areaRatio = 0.0;
45864591
for(unsigned int i = 0; i < polygons->size(); ++i)
45874592
{
45884593
intersectGeometry = mGeos->intersection((*polygons)[i]);
4589-
if(intersectGeometry->getArea() > 0.00000000001)
4594+
areaRatio = intersectGeometry->getArea() / (*polygons)[i]->getArea();
4595+
if(areaRatio > 0.99 && areaRatio < 1.01)
45904596
{
45914597
testedGeometries.push_back((*polygons)[i]);
45924598
}

0 commit comments

Comments
 (0)
Please sign in to comment.