Skip to content
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

grass.jupyter: Allow users to draw simple geometries and save it as vector #4003

Merged
merged 18 commits into from
Aug 8, 2024

Conversation

29riyasaxena
Copy link
Contributor

@29riyasaxena 29riyasaxena commented Jul 8, 2024

Hi Everyone,

This pull request adds a new feature to grass.jupyter.interactivemap.py: a "Draw Geometries" button that lets users create and add geometries to the map as a GRASS native vector map.

Here’s how it works:

  1. Click the Pencil button to activate the drawing tool.
  2. You can then draw a polyline, polygon, or circle marker on the map.
  3. Enter a name for the new vector map in the "New vector map name" text box.
  4. Click the Save button to finalize and add the geometry.
  5. The new layer will be added to the map, and the drawing interface will automatically close.

For a visual guide, please check out the following recording:

grass_draw_geometries.mp4

@github-actions github-actions bot added Python Related code is in Python libraries notebook labels Jul 8, 2024
@petrasovaa
Copy link
Contributor

Right now it's not creating a GRASS vector, it's just adding geojson layer to the map. The vector needs to be imported, I think v.import should do that as we discussed before.

@29riyasaxena
Copy link
Contributor Author

should do

Hi Anna,
Yes, I remember. I hadn't thought of saving them as vectors. Sorry about that. I've pushed the changes now.

@petrasovaa
Copy link
Contributor

This is not working, in the jupyterlab log I get:

Failed to import geometries into GRASS GIS: a bytes-like object is required, not 'str'

Please test more. Run it in the notebook and check the output is correctly written as a vector map.

@petrasovaa petrasovaa changed the title Allow Users to draw simple geometries grass.jupyter: Allow users to draw simple geometries and save it as vector Jul 11, 2024
@29riyasaxena
Copy link
Contributor Author

Hi Anna, I can successfully add vectors and save them, but I am stuck on the part when deleting them. I tried clearing all the geometries and removing layers when clicking the delete button, but things aren't working. Could you please share your opinions on this?

@petrasovaa petrasovaa self-requested a review August 7, 2024 20:43
@petrasovaa petrasovaa added this to the 8.5.0 milestone Aug 7, 2024
@petrasovaa petrasovaa marked this pull request as ready for review August 7, 2024 20:43
@petrasovaa petrasovaa enabled auto-merge (squash) August 8, 2024 03:13
@petrasovaa petrasovaa merged commit 8c22a55 into OSGeo:main Aug 8, 2024
24 checks passed
landam pushed a commit to landam/grass that referenced this pull request Aug 22, 2024
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libraries notebook Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants