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"><<a href="http://wonder.sk">wonder.sk</a>@<a href="http://gmail.com">gmail.com</a>></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 <<a href="mailto:mauricio.dev@gmail.com">mauricio.dev@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Hi,<br>
> I've been working on the QgsAzimuth plugin and recently some users told me<br>
> of a limitation on the code I wrote.<br>
> The snapping is not with enough precision.<br>
> The following code is the event that I wrote that tries to use snap and if<br>
> not possible, use the captured pixel as coordinate. Is it the right way of<br>
> implementing a snap tool?<br>
><br>
> def canvasPressEvent(self,event):<br>
> pixels=event.pos()<br>
> snapper=QgsMapCanvasSnapper(self.canvas)<br>
> snapped=snapper.snapToBackgroundLayers(pixels)<br>
> if len(snapped[1])>0:<br>
> xy=snapped[1][0].afterVertex<br>
> else:<br>
> #transforming pixels to x,y<br>
> transform = self.canvas.getCoordinateTransform()<br>
> xy = transform.toMapCoordinates(pixels) #captures the clicked<br>
> coordinate and transform<br>
> self.emit(SIGNAL("finished(PyQt_PyObject)"),xy) #return QgsPoint in<br>
> 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>