2

How do I get the coordinates in page units (i.e. millimetres) for a QgsComposerMap item?

I can get the upper left coordinate using pos, but can't see any method that provides access to the width and height, or the lower right coordinate.

>>> map_item = composition.getComposerItemById('map')
>>> map_item.pos()
PyQt4.QtCore.QPointF(6.0, 6.0)
2

To get the width of the map item in millimetres:

map_item.rect().width()

And to get the height of the item:

map_item.rect().height()
  • 1
    We really want longer answers here. Please explain hat he is trying, where to try it and why trying it will help. – Brad Nesom Jun 22 '15 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.