Summary
In this chapter, we learned how to write a PyQGIS application that lets the user select and edit features. We created a map tool that uses the selection-handling methods in QgsVectorLayer
to let the user select features, and learned how to work with the currently selected features within your program. We then looked at how the layer's editing mode allows the user to make changes and then either commit those changes or discard them. Finally, we created a series of map tools that allow the user to add, edit, and delete Point, LineString, and Polygon geometries within a map layer.
Putting all these tools together, your PyQGIS application can sport a complete range of selection- and geometry-editing features. In the final two chapters of this book, we will use these tools together with the knowledge we gained in the previous chapters, to build a complete standalone mapping application using Python and QGIS.