TransWikia.com

qgis2web Popup Hyperlink Based on Field with URL

Geographic Information Systems Asked on May 30, 2021

I have a string field called PIN. And I have a string field called PIN_SOA which has URLs.

enter image description here

I’m creating a webmap using qgis2web 3.16. I have popups enabled, and of the two mentioned fields I only want to see PIN in the popup, not PIN_SOA. Here’s how it looks now:

enter image description here

Is there a way to make PIN a hyperlink that opens the URL of the associated PIN_SOA field? For example, I want it to look like this:

enter image description here

I’m referencing these similar questions.
QGIS – Convert a text field to a clickable hyperlink, hotlink, or URL?,
Configuring URL link for popup window directly in qgis2web plugin?

One Answer

You can use a third field to show the link.

Creating a new field with an expression like this:

'<a href='+ "PIN_SOA" +'>'+ to_string("PIN") +'</a>'

The link will remain the same link, you just style it in a way that is comfortable to you.
To prevent some fields to be shown in the popup I would copy my layer to a virtual layer and use the new temp layer with only the fields you want in the popup.

enter image description here

Correct answer by Dror Bogin on May 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP