[postgis-users] Topology - RemoveUnusedPrimitives workflow

Alexandre Neto senhor.neto at gmail.com
Wed Nov 8 02:05:39 PST 2023


Thanks Sandro, I will. And I will try to PR on the documentation.

One extra question. When I add a topoGeometry column to a table with a geometry column, in QGIS, I now fail to be able to edit the table. It seems that the PostGIS provider forces me to use a key called tid. Nevertheless, I can't find this column anywhere in the table. The workaround is to load the layer in QGIS before adding the TopoGeometry column, which is cumbersome. Is this intended or could it be a bug?

Thanks,

Alex

On Tue Nov 7, 2023, 01:57 PM GMT, Sandro Santilli <mailto:strk at kbt.io> wrote:
> On November 7, 2023 12:40:47 PM GMT+01:00, Alexandre Neto <senhor.neto at gmail.com> wrote:
>> 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;
> Feel free to file an enhancement ticket for a RemoveOrphamedTopogeometries function to clean up the state you found yourself in
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20231108/bfb49757/attachment.htm>


More information about the postgis-users mailing list