[QGIS-Developer] QGIS and WebAssembly

Mats Taraldsvik mats.taraldsvik at gmail.com
Fri Mar 18 01:26:04 PDT 2022


Very cool :)

WebAssembly is also useful on the desktop: Another opportunity with
WebAssembly is supporting qgis plugins as  an alternative to python/c++. It
would provide the versatility of python (can be used across platforms) with
near native performance. I think WebAssembly isn't ready/mature for this
just yet (waiting on the component model to mature (
https://github.com/WebAssembly/component-model), but it might be a good
option - WebAssembly modules/binaries can be written in many different
programming languages so not limited to python and c++...

On Fri, Mar 18, 2022 at 12:36 AM Martin Dobias via QGIS-Developer <
qgis-developer at lists.osgeo.org> wrote:

> Hi all
>
> 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:
> https://wonder-sk.github.io/wasm/qgis.html
>
> 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
> from JavaScript) to load a QGIS project, do rendering to a QImage and then
> a bit of JavaScript to display the map image in HTML canvas and handle map
> navigation.
>
> 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...
>
> Cheers
> Martin
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220318/1dda833f/attachment.html>


More information about the QGIS-Developer mailing list