[postgis-users] Doubt about toTopoGeom tolerance

Alexandre Silva amsilva at infoportugal.impresa.pt
Thu Jul 2 04:47:19 PDT 2020


Hi,

That's exactly what i'm trying to do.

If you can provide that query it would be very helpful.
By the way your blog post about qgis forms using pyqgis also helped me a lot.

Obrigado pela ajuda,
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 20:21
Para: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Assunto: Re: [postgis-users] Doubt about toTopoGeom tolerance

Ah, now I get what you want.

You want to fix undershoots and overshoots, right?

No, just topology snapping won't work, because it only snaps to vertexes. Notice that the nearby edge also needs a vertex added in the closest point to the end of line. Otherwise you will always have a topological error there even if it's 0.000001 m.

I think I have a query for that somewhere. Some time ago I was planning to do a blog post about it, but it never came out.

Let me see if I can find it.

Alexandre Neto

A quarta, 1/07/2020, 17:05, Alexandre Silva <amsilva at infoportugal.impresa.pt<mailto:amsilva at infoportugal.impresa.pt>> escreveu:
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<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: 1 de julho de 2020 16:42
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 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%7C4c3acf23e699491deb3008d81df4007f%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292281107807008&sdata=Kg%2FOHhNj0IiufJkulowq2%2B2dTxKndSTP%2FFJInNJ3GXo%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%7C4c3acf23e699491deb3008d81df4007f%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292281107807008&sdata=BdSJgTiQ1HmpF8FDDH1hYvLZKwtNmzO3tZ2W068NZp4%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%7C4c3acf23e699491deb3008d81df4007f%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292281107816999&sdata=fvDPMXFRcWZHIAO6ArpuyI%2B8wA7lEHSypbBx98Rj2qo%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%7C4c3acf23e699491deb3008d81df4007f%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637292281107816999&sdata=fvDPMXFRcWZHIAO6ArpuyI%2B8wA7lEHSypbBx98Rj2qo%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200702/ad97505b/attachment.html>


More information about the postgis-users mailing list