I'm trying to export some PostGIS layers but getting these two errors when using the qgis2web plugin, seems to be memory related but is too many layers or too large an extent or something else? Also the plugin takes about 5 minutes to open:-

Traceback (most recent call last): File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\maindialog.py", line 101, in previewMap MainDialog.previewOL3(self) File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\maindialog.py", line 234, in previewOL3 previewFile = writeOL(self.iface, layers, groups, popup, visible, json, cluster, labels, params, utils.tempFolder()) File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\olwriter.py", line 53, in writeOL exportLayers(layers, folder, precision, optimize, usedFields) File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\utils.py", line 92, in exportLayers lines = f.readlines() MemoryError

and this error:-

MemoryError Traceback (most recent call last): File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\maindialog.py", line 111, in saveMap MainDialog.saveLeaf(self) File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\maindialog.py", line 257, in saveLeaf outputFile = writeLeaflet(self.iface, folder, 600, 400, 1, layers, visible, "", cluster, "", "", "", labels, 0, 0, json, params, popup) File "C:/Users/xxxxx.xxxxxx/.qgis2/python/plugins\qgis2web\leafletWriter.py", line 89, in writeLeaflet lines = f.readlines() MemoryError

1 Answer 1


I've never seen that error, and am sure that you are right that it relates to the complexity or size of your layers consuming a large amount of memory.

The plugin is slow to start up because it immediately builds a preview. You can comment this out. In the plugin file maindialog.py, at about line 56, place a # at the beginning of the line self.previewMap().

Beyond that, some more information about your data would probably help us find out whether there is a way we can improve the plugin to handle issues associated with large amounts of data.


I've just committed a change to try to address this issue. Try downloading master from https://github.com/tomchadwin/qgis2web, and see whether it solves it.

I believe you are bound to run into issues rendering large amounts of data in the browser, but it would be good to know whether this at least solves your specific issue.

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.