[Qgis-developer] QgsMapRenderer and DPI problem

Martin Dobias wonder.sk at gmail.com
Sat Sep 6 06:20:57 PDT 2014


Hi Stefan

On Tue, Sep 2, 2014 at 1:13 PM, Ziegler Stefan <Stefan.Ziegler at bd.so.ch> wrote:
>
> It seems that the dpi parameter in render.setOutputSize(img.size(), dpi) is not respected. For any value of dpi the line width is always the same in the output raster. It it respected when using map units for line widths and not milimeters, though. The script was used in an older QGIS version ages ago. So I'm pretty sure it worked once. Did I miss something or is it a bug?

It looks like something is wrong with the Python bindings there. In
render() method there is optional second parameter "forceWidthScale"
which is interpreted incorrectly and it seems to override the DPI
settings. Even if I add /In/ annotation to it, there are still some
issues. It seems it has been broken like this probably for long time.
If you want to do map rendering with different DPI settings I would
suggest one of these options:
- use QgsMapSettings / QgsMapRendererJob - if you target 2.4 and above
- use map composer

Regards
Martin


More information about the Qgis-developer mailing list