[QGIS-Developer] adding vertices to digitize session via python

Jonas qgis at ag99.de
Thu May 9 23:10:39 PDT 2019


Hello again,

nevermind, figured it out.

just casting the map tool to QgsMapToolCapture does the trick:

from qgis.core import QgsPointXY from qgis.gui import QgsMapTool, 
QgsMapToolCapturefrom qgis.PyQt import sipmapToolCapture = 
sip.cast(iface.mapCanvas().mapTool(), QgsMapToolCapture) 
mapToolCapture.addVertex(QgsPointXY(1,2))


Cheers

Jonas

On 09.05.2019 12:55, Jonas wrote:
> Hi,
>
> is there a way to add vertices to the rubberband when the user 
> currently digitizes a feature via the python API?
>
> For example when adding a line feature, the user has already created a 
> few vertices of a line via the rubber band. now i want to add the next 
> vertex of that rubber band via python. I do NOT want to end the users 
> action to create the feature, or add vertices to already existing 
> features.
>
> I think that would mean calling addVertex() on a 
> QgsMapToolCapture-object. However i cannot find a way to retrieve a 
> QgsMapToolCapture-object from the current mapTool.
>
> Is there a way to do this?
>
> Thanks
>
> Jonas
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190510/b41befc4/attachment.html>


More information about the QGIS-Developer mailing list