-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to "Open Dataset in QGIS" #2
Comments
Existing issue that discusses the details of what would be involved here a bit more: 2i2c-org/infrastructure#2985 |
From discussions with @yuvipanda, it seems like how we want to implement this: Similar to the One can see how the current DesktopHandler is setup in
So, I think the idea here would be to create a As a first version, let's accept something like a Once we have created Acceptance Criteria:
@wildintellect may need your help here figuring out what kinds of datasets can be passed in and what flags we can use when starting QGIS to open the dataset passed in correctly. @sunu let's go over this when we next chat and figure out next steps. @yuvipanda I think I've mostly grokked what we need to do here, but it's possible that it'd be helpful to have a quick chat with you before we kick this work off in earnest. cc @geohacker |
@batpad I suspect we'll want to rely on STAC where a "collection" == "dataset" or an "item" == "dataset", a To get started I think we need a user story with a particular dataset, so we can work through the process. @j08lue can you think of an relatively simple high value dataset to try from VEDA? |
We often use the Nitrogen Dioxide for demo purposes: https://radiantearth.github.io/stac-browser/#/external/staging-stac.delta-backend.com/collections/no2-monthly |
@batpad thanks for kicking this off! I think it would be useful for me to be in the first meeting as well, please include me in that? |
@batpad For a bare bones implementation, can we clarify what a dataset is and what it involves for opening such a dataset with QGIS? I tried the simplest example of opening a remote geojson file through QGIS cli and it doesn't quite work because QGIS assumes the file is a local file: (base) jovyan@4a63b62ddbec:~$ qgis "https://raw.githubusercontent.com/datameet/maps/master/Country/india-osm.geojson"
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-jovyan'
ERROR: Status 2: File /home/jovyan/https:/raw.githubusercontent.com/datameet/maps/master/Country/india-osm.geojson could not be found No luck with a viscurl url either: (base) jovyan@4a63b62ddbec:~$ qgis "/vsicurl/https://raw.githubusercontent.com/datameet/maps/master/Country/india-osm.geojson"
Warning: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-jovyan'
ERROR: Status 2: File /vsicurl/https:/raw.githubusercontent.com/datameet/maps/master/Country/india-osm.geojson could not be found Not sure if I'm using the wrong syntax to invoke qgis here. Can someone more familiar with QGIS verify please? But overall it looks like we need 2 steps to get "open a dataset in QGIS" to work:
Looks like a minimal implementation of step 2 is fairly straight-forward to implement by making a QGIS specific fork of jupyter-remote-desktop-proxy. But we need to discuss a bit more about how to implement step 1. If directly opening QGIS with a remote url doesn't work then another alternative would be to try and generate a project file pointing to the remote dataset and open QGIS with the generated project file preloaded. Or we can try to automate the steps of loading the data into a new layer with PyQGIS. |
@sunu great work here! @geohacker @wildintellect do you know if there's a good way to invoke QGIS with a remote URL as parameter so that it opens that dataset when it starts up? (I know the definition of "dataset" here can get really complex, but for a proof of concept, let's start with something simple like a GeoJSON) |
india.qgz.zip |
I have a working prototype that combines a minimal project template and a pyqgis script to automate loading remote vector data files. Here's a quick demo: qgis-in-jupyter.mp4I'll put the code in a repo once I clean things up a bit. cc @batpad |
Woo hoo, great to see this in action, @sunu! |
🤩 That's so cool, amazing work! |
@sunu can you link the code? |
I cleaned up the code a bit and upload it to https://github.com/sunu/jupyter-remote-qgis-proxy/ This is a Jupyter server extension that inherits from https://github.com/jupyterhub/jupyter-remote-desktop-proxy instead of forking it. Hoping this will be easier to maintain than a fork. @wildintellect The relevant part of the code for opening QGIS is here: https://github.com/sunu/jupyter-remote-qgis-proxy/blob/772c016b413a0faae64110d7a147bd0cfadb2a3f/jupyter_remote_qgis_proxy/qgis/utils.py#L5 And to test it out, I have a branch on my fork of nasa-qgis-image that uses this server extension. To run this locally, you can clone the repo and run the following commands:
|
We're deploying this to the hub: 2i2c-org/infrastructure#4299 Once ^ this is deployed, you should be able to test with a link like this: You should be prompted to login. You MUST select the QGIS image in the profile selection screen, and then hit Start Server. (we will be working to improve the automatic profile selection from URL parameters in the next quarter) Once your QGIS container starts, it should automatically load up the dataset specified in the URL, i.e. https://raw.githubusercontent.com/flatgeobuf/flatgeobuf/master/test/data/countries.fgb . This should work for common vector formats hosted on public URLs. (Once the QGIS container is already running, subsequently opening a new dataset with a link similar to the above link will open it in the same container and not spin up a new container). It should be reasonably trivial to add other data formats / anything that QGIS supports once we confirm this works well. |
Video demo: qgisdemo.mp4 |
We have this deployed on the VEDA hub! Am going to close this issue and we'll open separate issues for:
Thanks much @sunu for your amazing work on this and @yuvipanda for all the guidance and support! |
At a high-level, we should have a button in the VEDA UI on the dataset page that would allow a user to "Open the dataset in QGIS" - this would take the user to a QGIS instance running inside of VEDA hub and open the selected dataset in QGIS.
Existing work on the QGIS image and setting up default data sources is here: https://github.com/2i2c-org/nasa-qgis-image/issues
Related issue about pre-loading QGIS with access to Earth Data datasets is here: 2i2c-org/infrastructure#3479
We can break-down tasks and refine our approach here.
cc @yuvipanda @geohacker
The text was updated successfully, but these errors were encountered: