Image Labelling

11 views
Skip to first unread message

Slade Beard

unread,
Jun 24, 2025, 11:34:23 PM6/24/25
to QGIS Australia User Group
Hi Team,

I am doing an infrastructure cabling diagram. I have a large (1600+) set of images that I have grouped up based on pit numbers. I have used the Import Photos plugin to bring all the images onto the map. I would like to have a single label for each pit set based on the folder name in which they are collected.  Is there a programmatic way to do this? Python has some great os based procedures and perhaps there is some way to use them to do accomplish this? 

Any thoughts on a way that might work? 

John Bryant

unread,
Jun 24, 2025, 11:42:57 PM6/24/25
to australian-qg...@googlegroups.com
Hi Slade,

Are you trying to produce a single label for several point features? One thing maybe worth trying is a virtual layer that aggregates the points based on an attribute or expression, and then use that virtual layer for the labels.

Cheers
John

--
You received this message because you are subscribed to the Google Groups "QGIS Australia User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-use...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/australian-qgis-user-group/b8995edf-d053-4db3-9ab7-c3e77cdf2289n%40googlegroups.com.

Grant Boxer

unread,
Jun 25, 2025, 12:33:09 AM6/25/25
to australian-qg...@googlegroups.com

Hi Slade,

 

You can use the attribute form to allow photos to be attached to a point, and in the form layout you can specify a field (e.g. caption) to be displayed with the photo.

 

Was that what you are looking for? Happy to discuss.

 

Cheers Grant

--

Slade Beard

unread,
Jun 25, 2025, 12:53:50 AM6/25/25
to australian-qg...@googlegroups.com
Thanks. Problem solved. There are a number of steps in this process to supply the data in the form that the engineers want it to be provided. Its important to note that iphones now use the .heic extension for photos and coordinates are stored in lat/long.

  1. Sort the images into folders named by pit eg Pit 22 
  2. Convert existing filename to consecutive numbered images in each pit folder Pit 22_001, Pit 22_002
  3. Extract the co-ordinates from all the images 
  4. Convert coordinates to easting / northing
  5. Convert the images from .HEIC to .jpg
  6. Write the foldername, filename, lat/long and easting northing out to a .csv
  7. Process the eastings / northings  to obtain the centroid in each folder and store in a centroids.csv
  8. Import all images into QGIS 
  9. Add the centroids.csv as a new layer.

 Mission accomplished. I am sure with time I could clean up the pseudocode  and the resulting python code, but hey this got the result. CodeGPT was able to convert the pseudocode into python (again - probably not the neatest bit of python coding - but it was coded quickly and only required a handful of changes to achieve the endstate. 

Cheers (hope this is of use to someone facing a similar problem :-) )


From: australian-qg...@googlegroups.com <australian-qg...@googlegroups.com> on behalf of John Bryant <johnw...@gmail.com>
Sent: Wednesday, June 25, 2025 1:42 PM
To: australian-qg...@googlegroups.com <australian-qg...@googlegroups.com>
Subject: Re: [QGIS-Australia-User-Group] Image Labelling

Slade Beard

unread,
Jun 25, 2025, 12:56:05 AM6/25/25
to australian-qg...@googlegroups.com
Gidday Grant. Your solution is probably neater - my problem was the sheer number of images I had to process. You will see the pseudocode for my very rough solution. Thanksfully it worked 🙂 

From: 'Grant Boxer' via QGIS Australia User Group <australian-qg...@googlegroups.com>
Sent: Wednesday, 25 June 2025 2:33 PM
To: australian-qg...@googlegroups.com <australian-qg...@googlegroups.com>
Subject: RE: [QGIS-Australia-User-Group] Image Labelling
 
Reply all
Reply to author
Forward
0 new messages