September 2016
Beginner to intermediate
486 pages
10h 56m
English
A plugin will interact with the map canvas to get some useful information. This information could be, for example, point coordinates or features identified by these coordinates. We can use them to draw geometry entities such as points, lines, or polygons.
The QgsMapCanvas class is the class that represents a QGIS canvas. There can be different canvas instances, but the main canvas instance can be referenced with the following code snippet:
mapCanvas = iface.mapCanvas()
The QgsMapCanvas class generates some useful events to support location-based plugins. For example, xyCoordinates() sends point locations based on canvas coordinates and the keyPressed() event allows us to know which mouse button ...
Read now
Unlock full access