Hello all,

  I am working with the QgsGeometrySnapper pyqgis class, and have a problem
to snap to a reference layer which is created inside a function (and
returned by it).

  The code shared at [1] prints:

result = <QgsGeometry: Polygon ((0.10000000000000001 -0.10000000000000001,
10.09999999999999964 0, 9.90000000000000036 10.09999999999999964, 0 10,
0.10000000000000001 -0.10000000000000001))>

  Which means that the geomPolygon was not snapped to the reference layer.
  But, if uncomment the line 41, which adds the reference layer to the
project, the code prints:

result = <QgsGeometry: Polygon ((0 0, 10 0, 10 10, 0 10, 0 0))>

  So, for some reason, adding the reference layer to the project makes the
snapper to work.

  I want to ask you if you know why is this happening. Maybe I need to add
something to make it work consistently.


Regards,
Gabriel

[1] https://pastebin.com/raw/Y9v51ZMq
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to