I'm facing a big challenge. 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. Thanks in advance if you can help me.


Not 100% sure I understand the question, but 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.

  • That sounds interesting, I'll try to solve my problem using your method, let's see if this can work. I really appreciate it. Jun 2 '20 at 20:38
  • Thank you, your solution worked perfectly. Jun 8 '20 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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