- Release plans recap for the road to QGIS 1.0
- New version of eVis
- Contour Lines in Qgis
- QGIS and Google Summer of Code
- Quantum GIS Graduates OSGeo Incubation
- Paolo Cavallini Named to QGIS Project Steering Committee
- Nominations for QGIS PSC Open
- Capturing map coordinates in a stand alone app...
- Tutorial 7 - Creating spatial datasets with the QGIS API
- Html Image Plugin 0.2
Writing a QgsMapTool in Python
Submitted by spacedman on Thu, 2007-05-03 13:58.
For my project I need to give the user three ways to define a rectangular area: it can be the bounding box of a layer, it can be the current view area, or it can be defined by the user drawing a rectangle. My main dialog covers the first two options with a dropdown and a push button, but the third option meant writing a map tool - in Python of course!
The code and details are downloadable from my site.
In short, you create a new class that inherits from QgsMapTool, set the tool on the canvas to be your tool, and then just sit back as the user interacts with the tool via the events generated. It all worked pretty well first time in Python.
So, here's hoping people will build lots of useful map tools!
Barry
»
- spacedman's blog
- Add new comment
- 3341 reads

sounds very interesting -
sounds very interesting - but how to integrate in Win-binary-Version? Is there a way? Copied it to \Quantum GIS\share\qgis\python but it doesn't appear in QGIS.
Thanx
Kai
sounds very interesting -
sounds very interesting - but how to integrate in Win-binary-Version? Is there a way? Copied it to \Quantum GIS\share\qgis\python but it doesn't appear in QGIS.
Thanx
Kai