[postgis-users] Question on topology

Sandro Santilli strk at kbt.io
Wed Jul 13 03:55:11 PDT 2016


On Tue, Jul 12, 2016 at 01:15:41PM +0200, Neumann, Andreas wrote:
> Hi Sandro, 
> 
> I let this function run during the night and after 7.5h I got an error
> message: 

Eh, that's why I suggested loading the topology in batches.

Use constructs like:

  SELECT TopoGeo_addPolygon(...)
  FROM input_table
  WHERE gid >= $1 AND gid < $2

With $1..$2 in a range that makes it run within a few minutes.

Or, alternatively, code the loop in plpgsql by intercepting
exceptions and skipping the "offending" input to analyze later
(but I like the multi-transaction approach better as it allows
you to see the topology in QGIS while it's being loaded).

> ERROR: Corrupted topology: adjacent edges 159972 and -159958 bind
> different face (0 and 78697)

It means that somehow the ST_CreateTopoGeo function in a given
stage created a corrupted topology. This is usually due to some
robustness issue. Snapping may help a little with this.

Once again, note that if this was being done in a loop you might
have stopped and looked at the issue with QGIS, to continue after
the topology validity was fixed.

> I have to say that I did not tune Postgis memory-wise - maybe I should
> do that next. But the above error message probably doesn't indicate a
> memory problem, but a problem with the data. 

Correct, it's not a problem with memory.

> My data: 2582 polygons with a total of 167176 vertices. 

Try loading it in chunks of 300 polygons

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html


More information about the postgis-users mailing list