Accessing layer properties for expression syntax in QGIS Modeler

coordinate systemqgisqgis-expressionqgis-modelerqgis-variable

Overview: In QGIS I want to create a conditional branch in the model designer so that I can pass images with 20m resolution through the 'Warp (reproject)' tool. Images that are already at 10m resolution will skip this step.

Tool: Conditional Branching

Problem: To be clear, I am new to expressions in QGIS (and QGIS as a whole). I do know coding, however. It appears as though there is a selection of variables that one can choose from when creating an expression (condition) for the 'Conditional Branch' tool.

enter image description here

I would like to access the pixel size value, however, it appears as if this argument is not a straightforward argument to be passed. Instead, one must first access the property via the argument crs_description (if I understood correctly). However, from this point on, I am lost.

enter image description here

I did run raster information on the image, which is how I concluded that the 'Pixel Size' value is a crs property and not part of the metadata. How can I access this attribute from the 'crs_description' argument passed to the 'layer_property' function?

enter image description here

And as a final follow-up question, will the layer_property() function return the pixel value? In this case, I assume I would then need to change the function to be similar to the following:

enter image description here

Best Answer

You can use Raster layer properties:

enter image description here

@Raster_layer_properties_PIXEL_HEIGHT > 15

The conditions are used as dependencies to the following tools:

  • If the input raster has a pixel size above 15: Extract its extent,
  • If below 15: Create some random points.
Related Question