[postgis-users] Getting TopologyExections when trying to node linestrings to create an overlay

Sandro Santilli strk at keybit.net
Mon Feb 9 03:25:25 PST 2015


On Tue, Feb 03, 2015 at 11:28:35AM -0500, BladeOfLight16 wrote:

> https://drive.google.com/file/d/0B_6I7kRgE8teVUpha2Q4ZlNDMWs/view?usp=sharing.

...

> DO $$
> DECLARE problem_row error_generating_polygons%ROWTYPE;
> BEGIN
>   FOR problem_row IN (SELECT * FROM error_generating_polygons) LOOP
>     BEGIN
>       PERFORM ST_Union(ST_Boundary(geom))
>       FROM UNNEST(problem_row.polygons) p (geom);
>       RAISE NOTICE 'geom_set_id % succeeded', problem_row.geom_set_id;
>     EXCEPTION
>       WHEN OTHERS THEN
>         RAISE NOTICE 'Error for geom_set_id % (Code %): %',
> problem_row.geom_set_id, SQLSTATE, SQLERRM;
>     END;
>   END LOOP;
> END
> $$;

First of all I confirm it still happens with GEOS="3.5.0dev-CAPI-1.9.0 r4038".
Second, I took a look at a random set (geom_set_id=1) and I found it pretty
big. That's to say you could probably further reduce the dataset for the
ticket. That set contains 109 polygons, I can get the error by attempting
to union the boundaries of the first 40 in that set, and I'm sure you can
further reduce the input.

So my suggestion:
 
 1) file the ticket
 2) attach the _smallest_ input that reproduces the problem

About ST_IsValid: lines are always valid, so there's no need to test.
Most likely this is a robustness issue failing to deal with very close
but not equal lines.

NOTE: I've tried my reduced input (~40) geoms against the topology builder
and it also resulted in errors, until I specified a tolerance of 1e-4.

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the postgis-users mailing list