[postgis-users] Topology - RemoveUnusedPrimitives workflow

Alexandre Neto senhor.neto at gmail.com
Tue Nov 7 03:40:47 PST 2023


Hi Sandro,

Many thanks for your answer, I think that running the clearTopoGeom in the trigger function may work, as the idea is do all this inside a before update trigger function row by row, whenever the original geometry is changed.

Thanks,

Alexandre Neto

On Tue Nov 7, 2023, 11:33 AM GMT, Sandro Santilli <mailto:strk at kbt.io> wrote:
> 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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20231107/714705b8/attachment.htm>


More information about the postgis-users mailing list