Hi Martin,<br>Actually, it depends on some still unknown factor. If i remember right I found a 2 cm error with 100m coordinates.<br>Hum... my plugin is available in the comunity repository if you need to test the snapping error. QgsAzimuth.<br>
Mauricio de Paulo<br><br><div class="gmail_quote">2009/11/14 Martin Dobias <span dir="ltr">&lt;<a href="http://wonder.sk">wonder.sk</a>@<a href="http://gmail.com">gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/11/12 Maurício de Paulo &lt;<a href="mailto:mauricio.dev@gmail.com">mauricio.dev@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Hi,<br>
&gt; I&#39;ve been working on the QgsAzimuth plugin and recently some users told me<br>
&gt; of a limitation on the code I wrote.<br>
&gt; The snapping is not with enough precision.<br>
&gt; The following code is the event that I wrote that tries to use snap and if<br>
&gt; not possible, use the captured pixel as coordinate. Is it the right way of<br>
&gt; implementing a snap tool?<br>
&gt;<br>
&gt;  def canvasPressEvent(self,event):<br>
&gt;     pixels=event.pos()<br>
&gt;     snapper=QgsMapCanvasSnapper(self.canvas)<br>
&gt;     snapped=snapper.snapToBackgroundLayers(pixels)<br>
&gt;     if len(snapped[1])&gt;0:<br>
&gt;         xy=snapped[1][0].afterVertex<br>
&gt;     else:<br>
&gt;         #transforming pixels to x,y<br>
&gt;         transform = self.canvas.getCoordinateTransform()<br>
&gt;         xy = transform.toMapCoordinates(pixels) #captures the clicked<br>
&gt; coordinate and transform<br>
&gt;     self.emit(SIGNAL(&quot;finished(PyQt_PyObject)&quot;),xy)     #return QgsPoint in<br>
&gt; a signal<br>
<br>
</div></div>Hi,<br>
<br>
could you quantify how big is the loss of precision (expected vs.<br>
obtained coordinates)?<br>
>From a quick look the code for snapping should be fine.<br>
<font color="#888888"><br>
Martin<br>
</font></blockquote></div><br>