<div dir="auto">Ah, now I get what you want.<div dir="auto"><br></div><div dir="auto">You want to fix undershoots and overshoots, right?</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Let me see if I can find it.</div><div dir="auto"><br></div><div dir="auto">Alexandre Neto</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">A quarta, 1/07/2020, 17:05, Alexandre Silva <<a href="mailto:amsilva@infoportugal.impresa.pt" rel="noreferrer noreferrer" target="_blank">amsilva@infoportugal.impresa.pt</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
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.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Shouldn't it snap to the closest point on that edge, which is within the tolerance?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Thanks,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Alexandre Silva<br>
</div>
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838Signature">
<div></div>
</div>
</div>
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> postgis-users <<a href="mailto:postgis-users-bounces@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users-bounces@lists.osgeo.org</a>> em nome de Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">senhor.neto@gmail.com</a>><br>
<b>Enviado:</b> 1 de julho de 2020 16:42<br>
<b>Para:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users@lists.osgeo.org</a>><br>
<b>Assunto:</b> Re: [postgis-users] Doubt about toTopoGeom tolerance</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am not sure I understood your affirmation. wanting to snap to the nearest edge, its the same as using a very large tolerance.</div>
<div><br>
</div>
<div>Alexandre Neto</div>
</div>
<br>
<div>
<div dir="ltr">On Wed, Jul 1, 2020 at 3:47 PM Alexandre Silva <<a href="mailto:amsilva@infoportugal.impresa.pt" rel="noreferrer noreferrer noreferrer" target="_blank">amsilva@infoportugal.impresa.pt</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Thank you for your response.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
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.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
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).</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Thank you for your assistance,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Alexandre Silva<br>
</div>
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605Signature">
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px"><span id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605ms-rterangepaste-start"></span></p>
<table style="color:rgb(33,33,33);font-size:15px;width:430px" width="430">
<tbody>
<tr>
<td><br>
</td>
<td><br>
</td>
<td><br>
</td>
<td><br>
</td>
</tr>
</tbody>
</table>
<br>
<p style="margin-top:0px;margin-bottom:0px"></p>
</div>
</div>
</div>
</div>
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> postgis-users <<a href="mailto:postgis-users-bounces@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users-bounces@lists.osgeo.org</a>>
em nome de Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">senhor.neto@gmail.com</a>><br>
<b>Enviado:</b> 29 de junho de 2020 23:49<br>
<b>Para:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users@lists.osgeo.org</a>><br>
<b>Assunto:</b> Re: [postgis-users] Doubt about toTopoGeom tolerance</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I have looked into the documentation, and it seems that there are two form of using toTopoGeom:</div>
<div>1. One to add new topogeometry an existing topology layer, and another to change an element. This is what you seem to be using.</div>
<div>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.</div>
<div><br>
</div>
<div>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. </div>
<div>My first try would be something like:</div>
<div><br>
</div>
<div><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">UPDATE lines_table<br>
</span><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"></span>
<div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">
SET topo = topology.toTopoGeom(geom, clearTopoGeom(topo), 0.1)<br>
</div>
<div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">
WHERE id = 1263;</div>
</div>
<div><br>
</div>
<div><a href="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" rel="noreferrer noreferrer noreferrer" target="_blank">http://postgis.net/docs/manual-dev/toTopoGeom.html</a><br>
</div>
<div><br>
</div>
<div>Good luck,</div>
<div><br>
</div>
<div>Alexandre Neto</div>
</div>
<br>
<div>
<div dir="ltr">On Mon, Jun 29, 2020 at 5:53 PM Alexandre Silva <<a href="mailto:amsilva@infoportugal.impresa.pt" rel="noreferrer noreferrer noreferrer" target="_blank">amsilva@infoportugal.impresa.pt</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
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.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
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:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
SELECT topology.CreateTopology('a_topology', 3763, 0.01, true); <br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span>UPDATE lines_table<br>
</span>
<div>SET topo = topology.toTopoGeom(geom, 'a_topology', 1, 0.1)<span><br>
</span></div>
<div><span>WHERE id = 1263;</span></div>
<div><span><br>
</span></div>
<div><span>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?</span></div>
<div><span>If this is the expected behaviour is there a better way to do what i'm trying to do?</span></div>
<div><span></span><br>
</div>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks in advance,<br>
</div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605x_gmail-m_5023270528477521244Signature">
<div>
<div id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605x_gmail-m_5023270528477521244divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px"><span id="m_-8514144916576301718m_-7788271071884546637m_-2850716158552805838x_gmail-m_2133870196473710605x_gmail-m_5023270528477521244ms-rterangepaste-start"></span></p>
<table style="color:rgb(33,33,33);font-size:15px;width:430px" width="430">
<tbody>
<tr>
<td>Alexandre Silva<br>
</td>
<td><br>
</td>
<td><br>
</td>
<td><br>
</td>
</tr>
</tbody>
</table>
<br>
<p style="margin-top:0px;margin-bottom:0px"></p>
</div>
</div>
</div>
</div>
<img src="http://newsletter.impresapublishing.pt/i/barra_ip.jpg"> </div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="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" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote>
</div>
</div>
</div>
</div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="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" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote>
</div>
</div>
</div>
</div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div>