I am using Map Composition, but I found in QGIS 2.14 (Essen) Text Editor that when I try to import MapComposerit returns that this module is not found.
This is the error :
File "C:/PROGRA~1/QGISES~1/apps/qgis/./python\qgis\utils.py", line 572, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ImportError: No module named MapComposer
When I writhe in the console:
help(MapComposer)
The module is not found
1 Answer 1
Not sure about the examples in the "QGIS Python Programming Cookbook" but in the PyQGIS Developer Cookbook, we have the following example
mapRenderer = iface.mapCanvas().mapRenderer()
c = QgsComposition(mapRenderer)
c.setPlotStyle(QgsComposition.Print)
x, y = 0, 0
w, h = c.paperWidth(), c.paperHeight()
composerMap = QgsComposerMap(c, x ,y, w, h)
c.addItem(composerMap)
-
Thank you, I am checking this now, it works at the moment ;) Then, we use QgsComposerMap to set the dimensions of our paper project? And from here we can establish all the elements of the map, such as scalebar, north arrow, text boxes, and so on?user64823– user648232016年04月20日 08:23:02 +00:00Commented Apr 20, 2016 at 8:23
from qgis.core import QgsComposerMap
.