3

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

asked Apr 19, 2016 at 15:00
2
  • 1
    Perhaps the QGIS API docs might help. If you're looking to add a composer map, you may need to use from qgis.core import QgsComposerMap. Commented Apr 19, 2016 at 15:35
  • The fact is that I am following "QGIS Python Proramming Cookbook", thus, I try to follow all the steps... now, trying to create a Map Composition. I look at this modude but, I saw this class, then, can I use: qc = MapComposer.MapComposer(qmlr=reg, qmr=mr) ? Or shall I write QgsComposerMap instead of MapComposer? Commented Apr 19, 2016 at 15:45

1 Answer 1

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)
answered Apr 19, 2016 at 17:59
1
  • 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? Commented Apr 20, 2016 at 8:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.