4

I have a text in an attribute table that contains a file path. I want a hyperlink to be displayed in the information about the object - in blue, underlined - as I saw in this tutorial: https://www.qgistutorials.com/en/docs/3/web_mapping_with_qgis2web.html

I changed the widget type in the attribute form to Text Edit-> Multiline-> HTML but after saving the changes still the object is identified as normal text. Have I done something wrong?

BTW: I have active path open action from this attribute and it works.

1st screenshot

2nd screenshot

6
  • Yes, sure! qgistutorials.com/en/docs/3/web_mapping_with_qgis2web.html
    – Shinobido
    Commented May 8, 2023 at 12:47
  • 1
    could this be realted to the encoding - e.g. see this question: gis.stackexchange.com/questions/458580/…
    – Vincé
    Commented May 8, 2023 at 12:51
  • 1
    rename the dashes and dots in your local drive or move your local url to c:/web replaces spaces ect with underscores.
    – Mapperz
    Commented May 8, 2023 at 13:02
  • 1
    See my answer, that should work in QGIS. However, exporting to QGIS2Web might not work as style/formatting etc. is not 100% compatible. You might need to re-program at least parts of your map.
    – Babel
    Commented May 8, 2023 at 13:10
  • 1
    Just tested: exporting with QGIS2Web to OpenLayers, clicking on the points opens a form with the attributes. Hyperlink works for the URL (feature 3 in my example), not for the filepath (feature 2). Asking about how you can create an URL that works after exporting with QGIS2Web is another question and you should post a new question for that 8you might link to this one here).
    – Babel
    Commented May 8, 2023 at 13:14

1 Answer 1

7

To make sure the filepath is recognized as such and not as a html link, use a file:/// prefix before the actual filepath - like in this example:

file:///C:/Users/DU/Desktop/my_image.jpg

Use Ctrl+Click to open the link

Screenshot: feature 1 with no link, features 2 and 3 will open the file/website with Ctrl+Click enter image description here

2
  • I had the same issue and it kind of worked with your solution - however not for relative paths. The relative paths are shown as a link to a file, but nothing opens.
    – ibdmn
    Commented Jun 5, 2023 at 10:17
  • You should post a separate question for that. You can link to this one here.
    – Babel
    Commented Jun 5, 2023 at 11:11

Your Answer

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

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