On Fri, Mar 14, 2014 at 12:02 AM, Carol Kraemer
<[email protected]> wrote:
>
> Would Project > Save as image.. in QGIS help you once you have set the map
> to the scale you want?

Hi thanks again for your reply. That probably would help but it
doesn't seem straightforward to control the output file image
dimensions from the scale. I found another way which does avoid the
compose and lets me control the extents and output file dimensions
correctly. Please find attached.

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
from PyQt4.QtCore import *
from PyQt4.QtGui import *

img = QImage ( QSize ( 21600, 10800 ), QImage.Format_ARGB32 )
rect = maprenderer.fullExtent()
fname = "world.png"

painter = QPainter()
painter.setRenderHint(QPainter.Antialiasing)
painter.begin(img)

maprenderer = QgsMapRenderer()
maprenderer.setExtent(rect)

layersidlist = [ layer.id() for layer in qgis.utils.iface.mapCanvas().layers() ]
maprenderer.setLayerSet(layersidlist)

maprenderer.setOutputSize ( img.size(), img.logicalDpiX() )
maprenderer.render(painter)

painter.end()
img.save ( fname, "png" )
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to