[postgis-devel] Autofix and retry for GEOS overlay ops
Sandro Santilli
strk at kbt.io
Thu Feb 8 05:23:56 PST 2018
On Sun, Feb 04, 2018 at 03:00:37PM +0000, Darafei "Komяpa" Praliaskouski wrote:
> which boils down to "try intersecting, if failed, MakeValid the inputs, try
> intersecting, fail if failed".
I'd say "if failed *and* input is invalid".
GEOS already checks the input upon hitting a topology exception,
and reports that with something like this:
ERROR: Error performing intersection: TopologyException:
Input geom 0 is invalid:
Self-intersection at or near point 5 5 at 5 5
So maybe you could parse that exception message to tell if
it's worth running a MakeValid.
You still want to emit a WARNING because the caller might prefer
to fix the inputs earlier in the process, for speed benefits
(for example I think ClipByBox is documented for possibly returning
invalid geometries, so a user would need to MakeValid those outputs)
A GUC to control whether or not to activate some behavior would
be useful (although painful to use/maintain). I'd also like to be
able to request a NULL in preference to an exception, for example,
as that's an easiest way to find out _which_ inputs are problematic
when dealing with big tables with lots of data...
--strk;
More information about the postgis-devel
mailing list