-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
…yle) This isn't actually a very good fix. The issue in the "maptopixel" simplification is still there, it is just less obvious, while sacrificing a bit of QgsGeometry correctness (like the fact that linear ring should have >= 4 points) Along the way I have added some comments that may help others decode why the code does things it does.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,6 +284,8 @@ static GEOSGeometry *createGeosLinearRing( const QgsPolyline& polyline ) | |
} | ||
else | ||
{ | ||
// XXX [MD] this exception should not be silenced! | ||
// this is here just because maptopixel simplification can return invalid linear rings | ||
if ( polyline.count() == 3 ) //-> Avoid 'GEOS::IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4' | ||
return 0; | ||
|
||
|
@@ -359,7 +361,16 @@ static GEOSGeometry *createGeosPolygon( const QgsPolygon& polygon ) | |
for ( int i = 0; i < polygon.count(); i++ ) | ||
{ | ||
GEOSGeometry *ring = createGeosLinearRing( polygon[i] ); | ||
if ( ring ) geoms << ring; | ||
if ( !ring ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wonder-sk
Author
Member
|
||
{ | ||
// something went really wrong - exit | ||
for ( int j = 0; j < geoms.count(); j++ ) | ||
GEOSGeom_destroy_r( geosinit.ctxt, geoms[j] ); | ||
// XXX [MD] we just silently return here - but we shouldn't | ||
// this is just because maptopixel simplification can return invalid linear rings | ||
return 0; | ||
} | ||
geoms << ring; | ||
} | ||
|
||
return createGeosPolygon( geoms ); | ||
|
5 comments
on commit 83d070e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, for the record, here in 2.12, we still face crashes with centroid fill with Point on Surface option. Deactivating simplification helps with less crashes, but still some remain.
I see a Geos Exception raising Self Intersection near crazy coordinates (exemple 133.2351 - 78.12654 when data are projected around 2000000 6000000).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @haubourg, related to this I have proposed an idea to avoid these errors.
http://hub.qgis.org/issues/3517#note-17
Best regards
Alvaro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @haubourg, please, could you test this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ahuarte47 , Unfortunatly not. I have no compile environment ready and a lot of other priorities this week.
I can share a dataset + qlr file that currently triggers the crash every time if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, do not worry, it can be postponed
Hi @wonder-sk, IMHO I think this code is dangerous: when a geometry has very small holes, a ring can be invalid, and now the main polygon will not be labeled (or other GEOS operation) because the GEOSGeometry is not created.