2

I want to have the text labels visible on my map.

Unfortunately, I don't know where is the error.

In both cases, the labels are based on one category. In one object I can see the label, in other not. When launch the map preview situation is opposite.

Doesn anyone know how to display the text labels in QGIs2web properly?

enter image description here

Geographos
  • 4,087
  • 2
  • 27
  • 88

1 Answers1

1

In the code in our _syle.js layer files we should replace the:

   if ("" !== null) {
    labelText = String("");
   }

with

   if (feature.get("Pole No.") !== null) {
    labelText = String(feature.get("Pole No."));
    }

and it will work

enter image description here

Geographos
  • 4,087
  • 2
  • 27
  • 88
  • Also this could help: https://gis.stackexchange.com/questions/269217/avoid-multiple-labels-for-the-same-layer-in-qgis2web-export/269222#269222 – Jürgen Nov 03 '20 at 07:43
  • Are you sure, that your solution is correct? Because within your screenshot "P9" is not within the point.... – Jürgen Nov 04 '20 at 18:38
  • As far as I am concerned I need the P9 to be visible at all. If you have a better solution, you can always suggest something different. I guess, that the alignment section in the code is "responsible" for that. – Geographos Nov 04 '20 at 18:42
  • You could use own svg symbols. With inkscape you can create svg symbols. For example P1-P9. But with a perfect design. Sure, not for all projects a solution. – Jürgen Nov 05 '20 at 22:17
  • 1
    You could use svg openclipart. These free cliparts you can change for your project. https://openclipart.org/detail/141541/numbers – Jürgen Nov 05 '20 at 22:22