Show images related to features in QGIS?

Can be done on identification.

You first need an attribute with the photo paths. Must be full path:

enter image description here

Then you set the widget of the attribute to Photo, through the image properties:

enter image description here

When you identify a feature, it will pop up an image:

enter image description here

Although you need to have "Auto open form" ticked on in the identify results, also it must only be identifying the layer with images, so the mode should be "Current Selection" so it will identify the layer selected in the layers panel:

enter image description here


This is also possible through layer styling by using a combination of a Geometry generator to create rectangular polygon placeholders for the image, and then Raster Image fill to insert the images. The raster location property can be data defined, but I haven't tested whether it will work with URL sources.

Example:

Geometry generator expression to convert a point into a rectangle 400 x 220 map units across (matching the photo aspect ratio):

bounds(  make_line( 
    translate( $geometry , -200, -110), 
    translate( $geometry , 200, 110)
    )
)

Point and rectange

Now give the rectangle a raster fill of a photo:

enter image description here

(Using QGIS 2.18.15 x64 on Windows 10)


This can also be done using "Map Tips".

  1. You have to add the URL to the attribute table like Vesanto did.

  2. You go to "Layer Properties" --> "Display", there you switch to html and add something like

    <img width="150px" src="[% "img_url" %]" />
    

Advantage with Map Tips --> no clicking needed!

Tags:

Qgis

Actions