[QGIS-Developer] QGIS and WebAssembly
wonder.sk at gmail.com
Thu Mar 17 16:36:15 PDT 2022
Recently I was wondering if it would be possible to have QGIS running
natively in browser thanks to WebAssembly. Many hours later, I have a
small, very rough, proof of concept:
If you have a reasonably up-to-date browser, you should be able to browse
the map - zoom in/out and move map, either with buttons or by dragging map
and using mouse wheel. And you can switch to other demo projects (but not
all work fully at this point).
For those that are not familiar with WebAssembly - the whole point here is
that ALL the map rendering is happening in your browser, there is no
server-side rendering going on. The demo QGIS projects get downloaded (as
.qgz) together with the source data files (.gpkg, .shp, .tif or others) and
all this gets loaded and processed by the browser.
How is the demo built: there's qgis core library with gdal/ogr provider and
the usual dependencies (PROJ, GDAL, GEOS etc), all compiled to a single
.wasm file using Emscripten. The output binary is over 30 MB, but it
compresses well to ~12 MB with gzip. It is built on top of Qt6 and many
hacks to get things somehow going. I have created a minimal C API (used
There is a long list of issues that would need to be solved in order to get
something useful out of this, but I am really excited about the prospect of
being able to run QGIS code natively in a web browser(!). WebAssembly is
nowadays supported by over 90% web users according to
https://caniuse.com/wasm - so it's quite widely available.
With some development effort, it will be possible to use WebAssembly to our
advantage in various ways. Imagine that people could just go to qgis.org
and start their QGIS session in the web browser (without draining QGIS
infrastructure - all code/rendering is run on the client!).
I am very keen to hear what you think about QGIS and WebAssembly. In the
coming days I would like to also get the build system and my hacks
available in a git repo, so that others can start to play with it...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the QGIS-Developer