[postgis-users] Doubt about toTopoGeom tolerance

Alexandre Silva amsilva at infoportugal.impresa.pt
Wed Jul 1 09:05:15 PDT 2020


Hi,

Sorry, i didn't explain myself clearly. I have a node (that is the end of an edge) that is less than 0.1m from another edge. If i use a tolerance of 0.2m it doesn't snap but if i use 0.5m it snaps to a node of that edge.
Shouldn't it snap to the closest point on that edge, which is within the tolerance?

Thanks,
Alexandre Silva

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

Hi,

I am not sure I understood your affirmation. wanting to snap to the nearest edge, its the same as using a very large tolerance.

Alexandre Neto

On Wed, Jul 1, 2020 at 3:47 PM Alexandre Silva <amsilva at infoportugal.impresa.pt<mailto:amsilva at infoportugal.impresa.pt>> wrote:
Hi,

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

Hi,

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;

http://postgis.net/docs/manual-dev/toTopoGeom.html<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpostgis.net%2Fdocs%2Fmanual-dev%2FtoTopoGeom.html&data=02%7C01%7Camsilva%40infoportugal.impresa.pt%7C7867de8d4278456b17d908d81dd5620b%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292149594408975&sdata=8J6ubjm8WNgNA%2BqDe%2BZ1YJbEJrWjlycj7dYnjs0qhM0%3D&reserved=0>

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:
Hi,

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





[http://newsletter.impresapublishing.pt/i/barra_ip.jpg]
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/postgis-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fpostgis-users&data=02%7C01%7Camsilva%40infoportugal.impresa.pt%7C7867de8d4278456b17d908d81dd5620b%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292149594408975&sdata=c8otUEmfU76dwNXRpPxZzCqw4onRfC%2B7Ax%2BEV%2Fu43XI%3D&reserved=0>
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/postgis-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fpostgis-users&data=02%7C01%7Camsilva%40infoportugal.impresa.pt%7C7867de8d4278456b17d908d81dd5620b%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292149594418969&sdata=1LfO1aB8VFc2lSS16TbXLnFZ%2BI3BO4YCkWb8JDULzQ0%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200701/d4321877/attachment.html>


More information about the postgis-users mailing list