iD icon indicating copy to clipboard operation
iD copied to clipboard

bad extract of a swimming pool

Open Mahabarata opened this issue 10 months ago • 8 comments

URL

https://www.openstreetmap.org/edit?way=1394540738#map=21/43.5739789/6.1844197

How to reproduce the issue?

  • follow the link above
  • right click on the swimming pool and select "extract"
  • as a result we have a node with the tag swimming_pool and an area with the tag "area=yes" + a red error "area has no description tag".

The extraction is clearly useless.

Screenshot(s) or anything else?

No response

Which deployed environments do you see the issue in?

Released version at openstreetmap.org/edit

What version numbers does this issue effect?

2.37.3

Which browsers are you seeing this problem on?

Firefox

Mahabarata avatar Jan 29 '26 16:01 Mahabarata

@Mahabarata, I looked into this and found that the "Extract" tool is causing a bug when used on single objects. Right now, it breaks too much data for features that aren't inside any object. (for eg, pool on a building)

@tordans @k-yle I'd fix this issue and raise a PR with the approach I mentioned below, So, please review them.

So, The Extract tool is essential for situations like for eg, a pool on a building, but when we click "Extract" on an separate object like swimming pool on ground, the editor take away the tag from the object and moves it to a tiny point.

This makes object's shape empty with just a "area=yes" tag. Because the object's shape is now empty, the editor immediately shows a red error saying "Area has no description."

Some Optimal Solution for improving utility of Extract Option:

  1. The "Extract" option should never leave an area as just area=yes. It should require a base tag (like leisure=swimming_pool) to remain on the polygon. so the physical object isn't lost.

  2. The "Extract" option in the right-click menu should only be enabled if a feature is contained within another area (eg: pool on a building) & the option should be disabled on remaining separate objects to prevent users from accidentally turning an area data into point data.

ak8abhinay avatar Jan 30 '26 06:01 ak8abhinay

I am not sure this is really a problem. Or one that is worth fixing. The idea of the extract tool is to make nodes from tags and separate them from the area. This is what happens here. In this specific case the extract does not make a lot of sense. But how would we know that… What would be the conditions? => Lets find those first and discuss edge cases…

tordans avatar Feb 01 '26 07:02 tordans

I am not sure this is really a problem. Or one that is worth fixing. The idea of the extract tool is to make nodes from tags and separate them from the area. This is what happens here. In this specific case the extract does not make a lot of sense.

In this case, for eg "Swimming Pool" The "Extract" tool moved every single tag from an area to a point. This caused the original shape became an empty "untagged" object (which triggered red error), and it lost important data that belongs to the object like "swimming pool" itself.

But how would we know that… What would be the conditions?

If an object is independent (like a swimming pool on ground level), the Extract tool is now disabled.

The reason is : Extracting tags from a independent object doesn't make sense because there is no other way to the tags to stay on. It would just turn a independent object into a single point and leave a useless, empty shape behind with no tags.

Now, If an object is within another object (like swimming pool on a building), the Extract tool is enabled, but the tool now does is :

Instead of wiping the object's tags completely, the tool retains the identity tags (like building or amenity) and structural tags (like level) on the original area. Resulting the tags that describe the physical object stay on the footprint. The new point still receives a copy of these tags so it has the correct icon and name, but the original area is no longer left as a unknown shape with red validation errors.

Lets find those first and discuss edge cases… @tordans, for sure.

I have already implemented and tested these changes locally:

operations/extract.js: Controls the visibility of the tool based on the object's relationships.

actions/extract.js: Handles the retention of tags.

If these conditions look good, I can submit a PR with this logic."

Otherwise, let's discuss any edge cases and then proceed.

ak8abhinay avatar Feb 01 '26 16:02 ak8abhinay

@tordans, here is detailed issue explaination

The "Extract tool" currently lacks a validation check to ensure that the source geometry remains a valid OpenStreetMap object after the operation. While the tool works correctly for "Object-in-Object" scenarios (e.g. a shop inside a building), it fails on independent features by leaving behind areas with no descriptive tags.

Analysis of two cases:

Scenario 1: Independent Features (The Failure)

A feature with a single descriptive tag, such as leisure=swimming_pool.

User selects "Extract" from the context menu.

Result: The tag is moved to a new Node, leaving the original Area with only area=yes.

Issue: This triggers the iD validation error "Area has no descriptive tags". The extraction is "useless" because it results in invalid data that requires manual cleanup.

Image Image Image

Scenario 2: Object-in-Object (The Success) A building containing a functional amenity, such as a Town Hall (amenity=townhall + building=civic) or a Cafe (amenity=cafe + building=yes).

Result: The amenity tag is extracted to a Node, but the Area remains valid because it retains its physical tag (e.g., building=civic).

Observation: The tool is only beneficial when the area has "fallback" tags to maintain its identity.

Image Image Image Image

Edge Cases The tool currently fails to account for:

Single-tag areas: Any area where the primary descriptive tag is the only thing defining the geometry (Playgrounds, Pools).

Features where removing the descriptive tag leaves only data (like source, name, or area=yes) which do not constitute a valid OSM feature on their own.

Fix: Modifying the Extract operation's logic. The tool should only be available if:

The feature has multiple primary tags (e.g both a building=* and an amenity=*).

OR the extraction logic is updated to prevent leaving an area with only non-descriptive tags like area=yes.

ak8abhinay avatar Feb 04 '26 01:02 ak8abhinay

In fact I just saw that this case is not the only one.

When we have a POI (a restaurant, a supermarket...) which is on the same area that a building, it make sense to be able to extract it (because restaurant may change when the building will stay the same so it is probably better to have 2 different elements). The tags restaurant and building are 2 primary tags and they may be separate if a mapper wants that.

When an area has only one primary tag (leisure=swimming pool, leisure=pitch, leisure=park), or a way has only one primary tag (leisure=track), it is a bug to be able to extract a node from the area/way.

Currently we cannot extract a node from an area wth the key landuse because a landuse means an area. It is more complicate with the key leisure because some may be area (a pitch), some may be a line (leisure=track), and some may be a node (fishing, if people may fish at a specific place of a lake).

For me the good control should be : if leisure is the only primary tag, no extraction. If leisure is with another primary tag (leisure=fishing+amenity=water, leisure=amusement_arcade+building=yes, leisure=bird_hide+boundary=national_park...) it makes sense to have extraction.

I think the title of this isssue should be changed into a more general case, according to these comments.

Mahabarata avatar Feb 08 '26 16:02 Mahabarata

When an area has only one primary tag (leisure=swimming pool, leisure=pitch, leisure=park), or a way has only one primary tag (leisure=track), it is a bug to be able to extract a node from the area/way.

I am not convinced this is always true. I might want to extract first and then re-tag the area as something else. One example might be an area that someone tagged as a school and I want the school to be a node and the area to become a building. The current workflow would work just fine.

The bigger question is … why do we consider the current feature an issue that we need to fix. A user clicks an option in the UI that he has to look for … so not something everyone sees right away. When selected, the user has to do things. The user can then decide to use undo or not.

There are cases when this is not working ideally. But is it really a problem? (Given, that there is not obvious better way…)

I think the title of this isssue should be changed into a more general case, according to these comments.

You as the author should be able to edit your issue.

tordans avatar Feb 08 '26 16:02 tordans

This is not a bug and working as intended. The extract operation only retains a specified small number of tags on the original object. Those are the building tag and related properties.

For when the original object does not have building tags, the remaining area object is of course untagged, leading to the validation warning that the mapper should chose a new preset for it (or remove it in case the polygon is not needed anymore). This is the intended workflow and does not need to be fixed.

tyrasd avatar Feb 10 '26 08:02 tyrasd

  • follow this link https://www.openstreetmap.org/edit?way=165373857#map=19/4.937191/-52.320609
  • extract a node of that way
  • look at the tags of the node, look at the tags on the way, tell me what the way could be and convince me that the extraction is a great feature of iD in this case, not a bug.

Mahabarata avatar Feb 15 '26 13:02 Mahabarata