[Qgis-user] Programmatically export layout with georeferenced file

DelazJ delazj at gmail.com
Thu May 24 10:02:02 PDT 2018


Hi all,

I have a layout on which I checked the "save world file" option in Layout
--> Exports settings
When I export this layout to image, I'd expect it to generate a world file
next to it considering that the generateWorldFile is an attribute of the
*ImageExportSettings* class [0]. But no world file. I use this kind of code

mylayout=QgsProject.instance().layoutManager().layoutByName('Composeur 1')
exporter = QgsLayoutExporter(mylayout)
exporter.exportToImage(filePath, QgsLayoutExporter.ImageExportSettings)

and then I check the image export settings with the next code

ls=QgsProject.instance().layoutManager().layouts()
for elt in ls:
  exporter = QgsLayoutExporter(elt)
  imgSettings = exporter.ImageExportSettings()
  print(elt.name(), imgSettings.generateWorldFile)

which returns False for any layout, including the one I checked the option
for. Btw, dpi returns -1.0, pages return an empty list... I guess I might
have missed something but...No idea.
When is the generateWorldFile set to True (if ever it's what will trigger
my world file export)?

[0]
https://qgis.org/pyqgis/master/core/Layout/QgsLayoutExporter.html#qgis.core.QgsLayoutExporter.ImageExportSettings

Thanks for your help,
Harrissou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180524/13580e67/attachment.html>


More information about the Qgis-user mailing list