When I export my QGIS generated shapefile with layers to a web map using qgis2web, the output map is showing repeated number of labels for the same layers. In my QGIS desktop, the label appears only once for each layer but once exported into a map, it shows multiple labels for the same layer. How can I solve this issue?
2 Answers
This is probably because your layers use multipart geometry. I'm afraid it's a limitation of the labelling techniques available in the webmapping libraries to which qgis2web exports that mean there is no solution for this yet.
The workaround is a hack. Turn off labelling on your layer. Add another point layer to your project, and style it with transparent outline and fill. Add a points to this new layer where you want your labels to appear. You'll obviously have to add a field for the label text. Turn labelling on on this layer.
-
Yes I did use multiple geometries and merged it into one later while creating the layer. :( Commented Jan 25, 2018 at 15:42
-
Will you be able to suggest me another software similar to qgis, because my research project requires me to create an interactive ancient world map. Commented Jan 25, 2018 at 15:49
-
-
I thought about this method before. If I do this, I will have multiple layers (Check box) in my layer pannel. My professor doesn't want me to have different checkboxes for the same geometry, unless there is a way to like both the checkboxes into one. Commented Jan 25, 2018 at 16:03
-
1Thanks Tom. I managed to solve this issue. I created additional shapefiles for each label (polygon) and merged that shapefile with the existing geometry shapefile. Later used the label shapefile field to show the labels. Commented Jan 30, 2018 at 9:02
I managed to solve this issue. I created additional shapefiles for each label (polygon) and merged that shapefile with the existing geometry shapefile. Later used the label shapefile field to show the labels.