1

I want to export a map using QGIS2WEB which mostly works fine apart from labels. I have some numbers I want to display inside circles. I have tried all the settings I can think of but I can't get the web output to scale the fonts when I zoom in and out. I've tried setting the size of the labels using mm, points, map units, meters at scale, inches etc. When I zoom in and out on the WebMap (in Chrome or IE) the circles scale perfectly but the font size of the label doesn't scale. This means the labels will not stay inside the circles and appear too big or too small depending on the zoom level I'm on.

Specifying the size of points an svg symbols using map units works as as would like but label font size doesn't.

I have also tried editing the the .js and .css output from web2map but it's minified and virtually impossible to follow the code and find out whats happening.

I'm using Qgis 3.12.0

Is this possible or is there a workaround to fix this? enter image description here

3
  • We need to know which map output format you are using - Leaflet or OpenLayers. The code is different for each, so each would have a different solution. From memory, I don't think zoom-dependent labels are supported in qgis2web at all, I'm afraid, so this would have to be developed. But if you can tell us which output format, someone might be able to help you edit the code to achieve what you want. Commented Apr 20, 2020 at 8:07
  • I've tried all three but the Leaflet option was what produced the screenshot in the question. If you could give me a hint as to which bit of the js or css it is I need to edit it may help. thanks.
    – MapMan
    Commented Apr 20, 2020 at 12:15
  • Search the code of index.html for bindTooltip, and you will see the font label properties. That said, you'll need to rewrite the whole tooltip bit to call a function on zoom, something like this: stackoverflow.com/questions/47943315/… Commented Apr 20, 2020 at 13:04

0

Your Answer

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

Browse other questions tagged or ask your own question.