[postgis-users] Doubt about toTopoGeom tolerance

Alexandre Silva amsilva at infoportugal.impresa.pt
Wed Jul 1 07:46:40 PDT 2020


Thank you for your response.

I tried the solution you provided and the result was the same, however after increasing the tolerance the geometry did indeed snap to a nearby node.
I thought that the snap was to the closest point on a nearby edge but it seems that it only snaps to nodes within the tolerance. What's the best way to snap a geometry to the closest point on a nearby edge? I cannot increase the tolerance as it would be error prone (to make the snap on one specific geometry I had to increase it from 0.1m to 0.5m).

Thank you for your assistance,
Alexandre Silva

De: postgis-users <postgis-users-bounces at lists.osgeo.org> em nome de Alexandre Neto <senhor.neto at gmail.com>
Enviado: 29 de junho de 2020 23:49
Para: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Assunto: Re: [postgis-users] Doubt about toTopoGeom tolerance


I have looked into the documentation, and it seems that there are two form of using toTopoGeom:
1. One to add new topogeometry an existing topology layer, and another to change an element. This is what you seem to be using.
2. The second form, with less arguments, is used ADD changes to existing topoGeometries. But, it says you may want to use clearTopoGeom(topo) to create a totally new shape.

My gut feeling is that since you already have the topogeometry in the topology, when you try to add it again, it will snap to the old geometry any way.
My first try would be something like:

UPDATE lines_table
SET topo = topology.toTopoGeom(geom, clearTopoGeom(topo), 0.1)
WHERE id = 1263;


Good luck,

Alexandre Neto

On Mon, Jun 29, 2020 at 5:53 PM Alexandre Silva <amsilva at infoportugal.impresa.pt<mailto:amsilva at infoportugal.impresa.pt>> wrote:

I have trying using the topology to correct some data with marginal errors and in some particular cases i'd like to use a higher snap tolerance than the defined in the topology.
The topology has a tolerance of 0.01m (using a metric projection) and some lines need an higher tolerance of 0.1m to be fixed. Here's the code i used to create the topology and to fix the particular cases:

SELECT topology.CreateTopology('a_topology', 3763, 0.01, true);

UPDATE lines_table
SET topo = topology.toTopoGeom(geom, 'a_topology', 1, 0.1)
WHERE id = 1263;

Even though the line is closer than 0.1m to another line, it isn't snapped. Am i thinking wrong here? Shouldn't the line be snapped? Which of the tolerances prevails?
If this is the expected behaviour is there a better way to do what i'm trying to do?

Thanks in advance,

Alexandre Silva

postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200701/14962275/attachment.html>

More information about the postgis-users mailing list