PyQGIS composer add picture by layer path field

by Mar   Last Updated May 23, 2020 01:22 AM

I want to create a atlas composer map using PyQGIS3. How can I take dynamic path by field from atlas layer?

enter image description here enter image description here

In PyQGIS3 I need some like this :

pict = QgsLayoutItemPicture(layout)

where myAtlas is my layer and pict is my field with paths.

Answers 1

For the expression, you should use the following

  file_exists(attribute(@atlas_feature, 'pict')),
  attribute(@atlas_feature, 'pict'),
May 23, 2020 01:06 AM

Related Questions

how to define correct atlas layers using PYQGIS?

Updated June 04, 2017 21:22 PM

Defining atlas feature margin using PyQGIS3

Updated May 25, 2020 11:22 AM

pyqgis export composer to single pdf file

Updated June 12, 2017 21:22 PM