I am trying to export a map with several shapefiles from QGIS to an OpenLayers web map. For that I tried the "Export to OpenLayers" and the "qgis2web" (Version 0.23.0) Plugin. I tried it before (one month ago) and back then both Plugins were working. Now I get a Python error which looks like that:

qgis2web produced an error:

Traceback (most recent call last):
File "C:/Users/Hannah/.qgis2/python/plugins\qgis2web\maindialog.py", line 99, in previewMap
File "C:/Users/Hannah/.qgis2/python/plugins\qgis2web\maindialog.py", line 232, in previewOL3
previewFile = writeOL(self.iface, layers, groups, popup, visible, json, cluster, labels, params, utils.tempFolder())
File "C:/Users/Hannah/.qgis2/python/plugins\qgis2web\olwriter.py", line 53, in writeOL
exportLayers(layers, folder, precision, optimize, usedFields)
File "C:/Users/Hannah/.qgis2/python/plugins\qgis2web\utils.py", line 68, in exportLayers
uri = TYPE_MAP[layer.wkbType()]
KeyError: -2147483647

I tried the Export on a Linux machine and on a Windows machine with two different versions of QGIS (2.0.1 and 2.10.1). With both I get the same error. The Python Version is 2.7.6

Apparently the error depends on the shapefiles. In case I only show the districts (polygon) then I don't get an error. As soon as I upload some point shapefile the error occurs. Anyone knows what the matter with the shapefiles? Why is it a problem with some to export them and with others it isn't?

One of the shapefiles that isn't working can be seen here (hospitals). Picture of settings Picture with different settings

  • The error comes when the plugin tries to identify the type of geometry of your layer. Are you able to upload the layer somewhere so I can take a look at it? – Tom Chadwin Sep 17 '15 at 12:25
  • I've used that .shp and it works fine for me. Do you have other layers open in QGIS when this error occurs? In other words, does the error occur when this is the only layer you have open? – Tom Chadwin Sep 18 '15 at 9:00
  • Hello, thanks for the answer. I tried it again with only one shapefile but I still get the same error. – Hannah H. Sep 18 '15 at 10:00
  • That same shapefile you linked to? – Tom Chadwin Sep 18 '15 at 15:53
  • Yes exactly. I downloaded it again to make sure. – Hannah H. Sep 21 '15 at 9:01

The original error caused by qgis2web being unable to identify a geometry type could not be reproduced. The subsequent error occurred because nothing was selected in the Template drop-down. Selecting "basic" got rid of the error.

However, dropdowns should not be blank when you load the plugin - something seems to have gone wrong with persisting the dialog settings. I've opened a ticket for it: https://github.com/tomchadwin/qgis2web/issues/113.

UPDATE: The original error occurred because the source layer had 2.5d point geometry. That was not handled at the time by qgis2web. Master branch on Github now handles this (https://github.com/tomchadwin/qgis2web), and a new plugin version will be released soon with the fix.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.