<div dir="ltr"><div>Very cool :)</div><div><br></div><div>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 (<a href="https://github.com/WebAssembly/component-model">https://github.com/WebAssembly/component-model</a>), 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++...<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 18, 2022 at 12:36 AM Martin Dobias via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all</div><div><br></div><div>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:</div><div><a href="https://wonder-sk.github.io/wasm/qgis.html" target="_blank">https://wonder-sk.github.io/wasm/qgis.html</a></div><div><br></div><div>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).</div><div><br></div><div>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.<br></div><div><br></div><div>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.</div><div><br></div><div>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 <a href="https://caniuse.com/wasm" target="_blank">https://caniuse.com/wasm</a> - so it's quite widely available.<br></div><div><br></div><div>With some development effort, it will be possible to use WebAssembly to our advantage in various ways. Imagine that people could just go to <a href="http://qgis.org" target="_blank">qgis.org</a> and start their QGIS session in the web browser (without draining QGIS infrastructure - all code/rendering is run on the client!).<br></div><div><br></div><div>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...</div><div><br></div><div>Cheers</div><div>Martin</div><div><br></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>