I'm trying to export a map to leaflet via qgis2web. I wanted to use OpenLayers, however, I cannot because it simply doesn't work. For reasons unknown, only certain layers work when trying to export. Layers of the same type, same projection, etc may or may not work. I also cannot have raster and vector together at once. I can't even have polygon and lines together, or even polygons and points together. I can have polygons, just ONE polygon layer, by the way, or I can have ONE raster image.

When the OpenLayers export fails, the map created is blank save for the background color and widgets. Here's what I get in these cases.

enter image description here

Sometimes, I get an error when rendering Open Layers like this:

RegionsNamedFixed_47aa8470_4ad9_41cc_92fa_58afaa0132f9 with renderer SINGLE: FILL SYMBOL (1 layers) color 231,113,72,0: Traceback (most recent call last): File "C:\Users/Meep/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\olStyleScripts.py", line 78, in exportStyles bufferColor, bufferWidth) = getLabelFormat(layer) File "C:\Users/Meep/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\olStyleScripts.py", line 193, in getLabelFormat max = 1 / ((1 / max) * 39.37 * 90.7) ZeroDivisionError: float division by zero 

Other times, I do not. These errors do not seem to help or matter, as I get the same failure state if they do or do not appear.

I figured I could just use leaflet instead. However, leaflet has its own bizarre problem. Aside from being amazingly slow to pan around and render things in, it's only rendering a tiny fraction of the map's labels. Here's a sample, and the labels only appear within this tiny region of this map.

enter image description here

Even worse, there should be green lines (roads) everywhere, not just in that tiny section of the map. It should look like this:

enter image description here

The data is all there, and I can click on a point, line, or polygon and get the popup showing its name and any other fields I left visible. However... This sort of defeats the purpose of a map. You need to be able to see what things are.

I have no idea what's wrong, or what I am doing wrong. I am using the version of qgis2web that can be presently downloaded through QGIS itself (3.16.0), and am running QGIS version 3.26.0-Buenos Aires.

1 Answer 1


There are some basic rules for setting up a project so that it can be exported with qgis2web. The first thing is to simplify the data by set the layers also as indicated in this guide by hiding the fields that are not of interest http://www.qgistutorials.com/it/docs/3/web_mapping_with_qgis2web.html I only know about the openlayers export of this plugin. If you place your data somewhere I can take a look at it. The layers must be unique and not grouped in QGIS, so export and then recreate the groups in the layerswitcher. You can see how to do it here https://github.com/tomchadwin/qgis2web/issues/977

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.