[postgis-users] Topology - RemoveUnusedPrimitives workflow
Alexandre Neto
senhor.neto at gmail.com
Thu Nov 2 08:26:22 PDT 2023
Hi,
I am trying to use the RemoveUnusedPrimitives function to clean up my topology and clean unnecessary primitives in the following (not working) way.
I have created a topology using
SELECT createtopology('master_topology', 3763);
To an existing linestring table I have added a topogeometry column using the following:
SELECT addtopogeometrycolumn(
'master_topology',
'temp',
'lines',
'topo',
'LINESTRING'
);
I have added a bunch of connecting lines to the temp.lines, them I populated the topo column:
UPDATE temp.troco SET
topo = totopogeom(geom, 'master_topology',1)
So far so good, I was able to load my faces in QGIS using this:
SELECT face_id, st_getfacegeometry('master_topology', face_id) AS geom
FROM master_topology.face
WHERE face_id > 0;
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)
Now, I expected to have edges, and eventually nodes on my topology that are not used in any topogeometry, so I tried to clean up the topology using RemoveUnusedPrimitives
SELECT RemoveUnusedPrimitives('master_topology');
It returned saying that no edges were removed. Because the function documentation asked for a extent I have also tried adding one:
WITH all_geom AS (
SELECT st_collect(geom) AS geom FROM temp.lines
)
SELECT RemoveUnusedPrimitives('master_topology', st_setsrid(st_extent(geom),3763))
FROM all_geom;
But I got the exact same result.
My idea was to keep the topology in sync with the lines geometries by running this steps in trigger functions and be able to get the updated faces as well whenever needed. Since this steps did not work, I am wondering if the function does what I was expecting to do, or if my workflow makes no sense at all.
Thanks,
Alexandre Neto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20231102/2f38a1e8/attachment.htm>
More information about the postgis-users
mailing list