[Qgis-user] mysterious polygon

Harrissou s. delazj at gmail.com
Sat Jun 10 17:57:39 PDT 2023


Hi Stephen,
You seem to have fallen in the annotation layer "trap" [0]. There is no layer behind and polygon deletion is mentioned in the docs I pointed to. Basically, select it with the "modify annotations" tool on the same toolbar, and press Del.

To create regular polygon feature, you have to select the layer, turn it into edit mode and use digitizing tools. Read [1].

Hope that helps.
Harrissou

[0] https://docs.qgis.org/3.28/en/docs/user_manual/map_views/map_view.html#interaction
[1] https://docs.qgis.org/3.28/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#digitizing-an-existing-layer

Le 11 juin 2023 01:22:43 GMT+02:00, Stephen Sacks via QGIS-User <qgis-user at lists.osgeo.org> a écrit :
>My intention was to create a new vector layer consisting of several polygons.  I used the CreatePolygon tool to mark the four vertices of a rectangle.  I must have done something wrong because I've ended up with a polygon that seems to belong to no layer.   In desperation I ran the following python code, hoping to delete the mysterious polygon, but it's still there.  Are some layers not in the legend?  How do I  get rid of the   polygon?
>========================
>from qgis.core import QgsProject
>from qgis.utils import iface
>
>project = QgsProject.instance()
>for lyr in project.mapLayers().values():
>    lyrName = lyr.name()
>    print (lyrName)
>    QgsProject.instance().removeMapLayers([lyr.id()])
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230611/6144c9d0/attachment.htm>


More information about the QGIS-User mailing list