[geos-devel] Correct use of setPrecision

Nyall Dawson nyall.dawson at gmail.com
Sun Sep 3 23:28:32 PDT 2017

Hi list,

As part of refactoring some QGIS code I was looking at replacing some
custom Python code [1] with the GEOS GEOSGeom_setPrecision function,
which appears to perform the same logic but much more efficiently.

However, after looking into this in more depth I think the original
python code is incorrectly used. It's being used by QGIS in order to
set a "tolerance" on a spatial join operation - i.e. to consider that
two geometries which are 100m distant actually do intersect.

My understanding is that the original code is badly broken, and that
using GEOS precision won't help here either, since there's no
guarantee that two vertices which are < 100 units distant will round
to the same result.

If this is correct, is there any other way in GEOS to handle this situation?


[1] https://github.com/qgis/QGIS/blob/master/python/plugins/processing/tools/vector.py#L219

More information about the geos-devel mailing list