Hi,
I tried to do a simple rendering of a few layers. Raster, Polygon and Linelayers always work like expected, just the points will not get rendered. I found an older simlar thread: http://osgeo-org.1560.x6.nabble.com/Problem-with-rendering-iwhen-units-are-millimeters-td5023073.html. If I change layers style units to 'map unit' its working, but not with 'millimeter'. Do I missed something?
from PyQt4.QtCore import *
from PyQt4.QtGui import *
canvas = qgis.utils.iface.mapCanvas()
render = QgsMapRenderer()
crsDestination = QgsCoordinateReferenceSystem()
crsDestination.createFromString("EPSG:4326")
render.setDestinationCrs(crsDestination)
render.setMapUnits(crsDestination.mapUnits())
render.setProjectionsEnabled(True)
from PyQt4.QtGui import *
canvas = qgis.utils.iface.mapCanvas()
render = QgsMapRenderer()
crsDestination = QgsCoordinateReferenceSystem()
crsDestination.createFromString("EPSG:4326")
render.setDestinationCrs(crsDestination)
render.setMapUnits(crsDestination.mapUnits())
render.setProjectionsEnabled(True)
extent = canvas.extent()
layers = []
for l in canvas.layers():
layers.append(l.id())
img = QImage(QSize(800, 600), QImage.Format_ARGB32_Premultiplied)
color = QColor(255, 255, 255)
img.fill(color.rgb())
p = QPainter()
p.begin(img)
#render = QgsMapRenderer()
render.setLayerSet(layers)
render.setExtent(extent)
render.setOutputSize(img.size(), img.logicalDpiX())
render.render(p)
p.end()
img.save("/tmp/render_issue.png","png")
layers = []
for l in canvas.layers():
layers.append(l.id())
img = QImage(QSize(800, 600), QImage.Format_ARGB32_Premultiplied)
color = QColor(255, 255, 255)
img.fill(color.rgb())
p = QPainter()
p.begin(img)
#render = QgsMapRenderer()
render.setLayerSet(layers)
render.setExtent(extent)
render.setOutputSize(img.size(), img.logicalDpiX())
render.render(p)
p.end()
img.save("/tmp/render_issue.png","png")
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
