wonder-sk / wasm

5 stars 0 forks source link

Question about this project #1

Open GeoCode-Dev opened 1 year ago

GeoCode-Dev commented 1 year ago

Hi,

I'm currently working on a WebGIS project that will aims to be used as a global database for environmental engineering offices.

The WebGIS will contain several tools for models and visualizes environmental data.

I was thinking of basing the core on QGis Quick API's. But using the newly introduced Qt target called WebAssembly to have a web based software.

So, I've found your project and I was wondering how did you manage to do that?

Does QGis needs some special configurations or is it possible to use QGis API's in WebAssembly strait forward as a "simple" Qt library?

Sincerely

wonder-sk commented 1 year ago

hi @GeoCode-Dev !

I was thinking of basing the core on QGis Quick API's. But using the newly introduced Qt target called WebAssembly to have a web based software.

Currently I think a better approach would be to take qgis_core library, provide Javascript API for it (with WebAssembly binary in the background) and implement GUI in JS with the usual web technologies. I thought about using Qt Quick + QGIS Quick as well, but it seems like there will be various limitations in the Qt Quick, and web browsers pretty much offer equivalent of Qt Quick with DOM+CSS+JS.

So, I've found your project and I was wondering how did you manage to do that?

In this demo I just compiled all the dependencies of qgis_core library, added a couple of C API calls to do things like load a project, render map at some extent, and use that from JS code.

Does QGis needs some special configurations or is it possible to use QGis API's in WebAssembly strait forward as a "simple" Qt library?

It is not yet straightforward unfortunately - I had to patch various bits of the QGIS code to get things compiled...

The good news though is that @boardend is planning to revive the efforts to bring QGIS to WebAssembly. If you are interested in joining forces in these efforts, it would be great to have a chat.

GeoCode-Dev commented 1 year ago

Thanks a lot for your reply.

I wanted to try with QGis Quick because I've developed and I will develop several tools based on Qt Quick, and I wanted to aggregate everything using one framework. And also, I was planning to use some code from various projects like the QField app witch already has many tools like a QGis drawer with all the layers displayed and so on.

But for sure, the feasibility is questionable. But since Qt6, the support for WebAssembly has increased a lot, and all the Qt Quick projects I've done, work pretty well on browsers so far.

Yes, for sure, opening a chat with @boardend would be great. How do you want to proceed ? Should we use GitHub or do you prefer another app/platform ?

Have a great day,

boardend commented 1 year ago

Hi @GeoCode-Dev

Let's use this issue for the moment (If needed we can open a Discord channel or schedule a meeting via Meet/Zoom later. And lets CC @andreasneumann, because he is interested in such a solution too)

I'm on the quest on porting QGIS to WebAssembly and very happy to hear that others are too! I've done the same for osgEearth, where you can find an early prototype on npm, see https://www.npmjs.com/package/osgearthwasm. The project is not yet publicly available on Github, but I have added you to the unpolished, and therefore still private repo.

Because osgEarth and QGIS share a lot of dependencies, my next step is to rename the whole project to a more generic name (@geowasm), publish it and reuse the stack to also compile QGIS with Qt6 and all other dependencies to WebAssembly.

The first goal is to make a TypeScript based library to use the QGIS renderer in the browser the same way as any other web mapping library. With such a library one would realize a GUI with regular HTML/CSS/JS, with maybe a SPA framework like Vue or React on top.

The next goal would be to bring as much of the QGIS desktop app to the browser. But to be honest, I have no idea if this is actually feasible. So let's just try and find out :smile:

I will use the latest release of QGIS and try to bring the needed WebAssembly patches upstream. In the end it would be nice to automatically detect the emscripten toolchain and configure CMake to cross compile QGIS without any further tinkering/patching.

I will keep you updated via this issue. Let us know what you are trying to do next. And if publicly available, please share your Qt Quick examples with us.