[Qgis-developer] Python Snapping
wonder.sk at gmail.com
Sat Nov 14 10:16:04 EST 2009
2009/11/12 Maurício de Paulo <mauricio.dev at gmail.com>:
> I've been working on the QgsAzimuth plugin and recently some users told me
> of a limitation on the code I wrote.
> The snapping is not with enough precision.
> The following code is the event that I wrote that tries to use snap and if
> not possible, use the captured pixel as coordinate. Is it the right way of
> implementing a snap tool?
> def canvasPressEvent(self,event):
> if len(snapped)>0:
> #transforming pixels to x,y
> transform = self.canvas.getCoordinateTransform()
> xy = transform.toMapCoordinates(pixels) #captures the clicked
> coordinate and transform
> self.emit(SIGNAL("finished(PyQt_PyObject)"),xy) #return QgsPoint in
> a signal
could you quantify how big is the loss of precision (expected vs.
>From a quick look the code for snapping should be fine.
More information about the Qgis-developer