<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 class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 1, 2020 at 3:47 PM Alexandre Silva <<a href="mailto:amsilva@infoportugal.impresa.pt">amsilva@infoportugal.impresa.pt</a>> wrote:<br></div><blockquote class="gmail_quote" 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="gmail-m_2133870196473710605Signature">
<div>

<div id="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="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="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="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" target="_blank">postgis-users-bounces@lists.osgeo.org</a>> em nome de Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" 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" 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%7C993cd4fd7266463c411908d81c7eb1b3%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C1%7C637290677762157357&sdata=V0GsN0KHhm5zLvM6S4aQRg%2F%2FFCP6jsNuWeX08aoVAjc%3D&reserved=0" 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" 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="gmail-m_2133870196473710605x_gmail-m_5023270528477521244Signature">
<div>
<div id="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="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" 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%7C993cd4fd7266463c411908d81c7eb1b3%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C1%7C637290677762167348&sdata=mFfo8W%2F%2BQ3nQJOyoE5OjvDro%2Fgrj4BgdkMapg58vs4s%3D&reserved=0" rel="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" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div>