I need to fill out new fields using "Field Calculator" in QGIS.

What do I need to load in those fields?

URL's containing the path to a image file (we can use the statement 'base_file_name'). The thing gets complicated when I'm talking about thousands of records (so I cannot copy and paste every single path into the field, I need to make it automatically during a Graphic Modeler processing).

The drop that spilled the glass is that I need that the fields should be filled out with a matching using an existing field in the Shapefile containing a string with a long text (example: "bf5ae62b-a7c9-4682-9c20-4c457de38a9b") and using this code to match it with a file within a folder (each image file name contains this code, for example: bf5ae62b-a7c9-4682-9c20-4c457de38a9b.jpg). I need to find an expression to make it possible and load all the URL at once using this criteria.

1 Answer 1


Here's a description of what I do in what seems to be an analogous situation.

I have a layer, Photos, which has a "SourceFile" field that has the fully qualified filename of jpegs. I periodically update it with another layer, NewObservations which has a field, "Identifier". Entries from NewObservations get pasted into Photos and then using field calculator I update the "SourceFile" field to:


In this case, @photo_directory is a layer-level variable with the directory of the photos, with trailing \ (Windows). I use a variable for portability.

By the way, I've done this both with "SourceFile" as an actual stored field, and as a virtual field defined in QGIS.

  • Awesome, thank you so much! Sep 15 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.