Fix and improve extract logic #11833
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that the current "Extract" operation can be a bit destructive. When you extract a named feature (like pool) from an area, it often wipes the original area clean, leading to "Area has no descriptive tags" validation errors.
This PR updates the tool about what it moves and what it keeps. It also ensures the tool doesn't appear for standalone objects where extraction wouldn't make sense.
Changes
actions/extract.js file : I added a list of identityKeys (like amenity, leisure, shop, etc.) that stay on the original area after extraction. This prevents the area from becoming "naked" and keeps it valid on the map.
Protecting the level tag and it is now kept on the original geometry rather than being moved to the point.
operations/extract.js file : Modified the tool's availability so it hides itself if an object has no parent ways or no other tags. This prevents users from accidentally turning a standalone building into a single point.
The new extracted node now receives a copy of the identity tags, ensuring it has the correct icon and remains searchable in the editor.
I tested everything locally and above mentioned solutions are working perfectly in the editor.
Fixes #11830