-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add remove_layer
method to Python GISDocument
API
#478
Add remove_layer
method to Python GISDocument
API
#478
Conversation
Integration tests report: appsharing.space |
remove_layer
method to Python document APIremove_layer
method to Python GISDocument
API
TODO: Unit test! |
9ea7c6d
to
758fa20
Compare
Thanks @mfisher87 for working on this, I thought it was already available, we've probably been talking about it since the very beginning of the Python API 😃
👍 |
Some API functions use the layer id, but I don't know if there is a way to easily display/copy that id from the UI. |
if layer is None: | ||
raise KeyError(f"No layer found with ID: {layer_id}") | ||
|
||
del self._layers[layer_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also remove the corresponding source if it is not used by another layer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems sensible! I'll do a bit of test-driven development today (or more realistically, tomorrow. No meetings on Fridays!) :)
Happy to! Main credit to @YaoTingYao :) |
Unit tests added. TODO: also remove orphan source! |
@brichet I would really like one more test: Add two layers from the same source, then remove one layer and check that there is still 1 layer and 1 source afterwards. I struggled with how to add multiple layers from the same source in the Python API. Am I perhaps missing an existing mechanism for this? |
Co-Authored-By: Matt Fisher <[email protected]>
for more information, see https://pre-commit.ci
5071244
to
ce88ce4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
Description
@YaoTingYao and I pair programmed on this during the hackathon!
Resolves #439
Checklist
Resolves #XXX
.Failing lint checks can be resolved with:
pre-commit run --all-files
jlpm run lint
📚 Documentation preview: https://jupytergis--478.org.readthedocs.build/en/478/
💡 JupyterLite preview: https://jupytergis--478.org.readthedocs.build/en/478/lite