[postgis-users] Topology - RemoveUnusedPrimitives workflow
Sandro Santilli
strk at kbt.io
Tue Nov 7 03:33:09 PST 2023
On Thu, Nov 02, 2023 at 03:26:22PM +0000, Alexandre Neto via postgis-users wrote:
> UPDATE temp.troco SET
> topo = totopogeom(geom, 'master_topology',1)
[..]
> Now I decided to remove one of the linestrings that splited two polygons.
>
> And I rerun the updated on the topo columns:
>
> UPDATE temp.troco SET
> topo = totopogeom(geom, 'master_topology',1)
This call does NOT remove the old TopoGeometries, which are left
orphaned (defined but not appearing in any TopoLogy Layer).
The returned text from this query should mention this problem:
SELECT TopologySummary('master_topology')
The clearTopoGeom function can be used to destroy a TopoGeometry,
but at this point it would probably be faster for you to do the
cleanup with direct DELETE on master_topology.relation WHERE the
layer_id/topogeo_id pair are not found in their respective layers
(dangerous operation). Suggestion/patches are welcome to improve
this situation. I've also noted the example for clearTopoGeom on
the manual is misleading:
https://postgis.net/docs/clearTopoGeom.html
> SELECT RemoveUnusedPrimitives('master_topology');
> It returned saying that no edges were removed.
It should tell you more if you:
set client_min_messages to debug;
> My idea was to keep the topology in sync with the lines geometries by running this steps in trigger functions
Maybe you can consider running the clearTopoGeom in a trigger function
too (on UPDATE...)
--strk;
More information about the postgis-users
mailing list