<div dir="ltr">Hello,<div><br></div><div>I am using the QgsLayoutExporter to build a screenshot of my QgsMapCanvas view, following the code in the Quick Print plugin (<a href="https://github.com/MarcoDuiker/QGIS_QuickPrint/blob/d1c946a7b6187553c92ffad7a0cc23d39a1bc593/quick_print3.py">https://github.com/MarcoDuiker/QGIS_QuickPrint/blob/d1c946a7b6187553c92ffad7a0cc23d39a1bc593/quick_print3.py</a>).</div><div><br></div><div>I build the QgsLayoutItemMap as follows (including only relevant lines):</div><div><br></div><div>map = qgis_core.QgsLayoutItemMap(layout)</div><div>...</div><div>mylayers = self.project.mapThemeCollection().masterVisibleLayers()<br>map.setLayers(mylayers)</div><div>...</div><div>layout.addLayoutItem(map)</div><div>...</div><div>exporter = qgis_core.QgsLayoutExporter(layout)<br></div><div>exporter.exportToImage(fil, qgis_core.QgsLayoutExporter.ImageExportSettings())<br></div><div><br></div><div>mylayers correctly lists the layers that I have loaded in my application.</div><div><br></div><div><p style="margin:0px;white-space:pre-wrap">[<QgsRasterLayer: '/vsimem/tj_patch_test_710_20220224_150745_depth_1_8.0.tif' (gdal)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0015_20200317_094852_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0014_20200317_093221_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0013_20200317_091555_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0012_20200317_090126_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0011_20200317_084855_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0010_20200317_083654_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0009_20200317_082551_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0008_20200317_081048_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0007_20200317_075822_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0006_20200317_074548_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0005_20200317_072016_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0004_20200317_071004_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0003_20200317_065753_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0002_20200317_064945_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0001_20200317_063913_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsVectorLayer: '0000_20200317_062845_S222_EM710.all' (ogr)>,</p>
<p style="margin:0px;white-space:pre-wrap"> <QgsRasterLayer: 'type=xyz&url=<a href="https://a.tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0&crs=EPSG:4326">https://a.tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0&crs=EPSG:4326</a>' (wms)>]</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Each of these layers correctly shows in the screenshot, with the exception of the first one, the vsimem based raster layer.  This layer shows in my app in the canvas, but is missing from the screenshot.  I have tried exporting that layer by itself, messing with renderers and opacity, etc.  I can't seem to get the vsimem raster layer to show in the screenshot.  I thought the WMS raster layer was going to be an issue, but it shows just fine.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Is there any issue with vsimem gdal layers?  Should this layer work, if I can visualize it on the canvas in my app?  I can't figure out where to go next to diagnose this issue.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Thanks,
Eric</p></div><div><br><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span><font color="#0000ff">Eric Younkin<br>Physical Scientist<br></font></span></div><div dir="ltr"><span><font color="#0000ff">NOAA OCS, </font></span><span style="color:rgb(0,0,255);font-size:12.8px">Hydrographic Systems and Technology Branch</span></div><div dir="ltr"><span><font color="#0000ff">1315 East-West Highway</font></span></div><div dir="ltr"><span><font color="#0000ff">N/CS11, Room 6604<br>Silver Spring, MD 20910</font></span></div><div><span><font color="#0000ff">Office: </font></span><span style="font-family:arial,sans,sans-serif;font-size:13px;white-space:pre-wrap"><font color="#0000ff">240-847-8208</font></span></div><div dir="ltr"><span><font color="#0000ff">
Cell: 828-331-8197</font><br>
</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>