Skip to content

when changing presets, delete keys from the old preset which are not in the new preset - #11696

Merged
tyrasd merged 3 commits into
developfrom
kh/remove-fields
Mar 16, 2026
Merged

tyrasd merged 3 commits into
developfrom
kh/remove-fields

Conversation

@k-yle

@k-yle k-yle commented Dec 16, 2025 •

Copy link
Copy Markdown
Collaborator

Previously discussed at openstreetmap/id-tagging-schema#1622 (comment)


Currently, if you change building=yes + building:levels=5 to landuse=grass, then the grass will still have building:levels, which is a bit weird.

There are endless examples like this. This topic has been discussed many times in different PRs. removeTags can solve this, but it's not clear when we should use removeTags.


New logic:

  • universal keys like name, check_data are always kept
  • keys that do not exist in the tagging schema are always kept, like ref:FR:some_random_tag
  • keys that are not used by the old preset are always kept
  • keys that exists in the old preset, but not in the new preset, are deleted.

@k-yle k-yle added preset An issue with an OpenStreetMap preset or tag id-tagging-schema An issue related to the id-tagging-schema repo labels Dec 16, 2025
@tordans

tordans commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator

universal keys like name, check_data are always kept

Is this part in the code already?

@k-yle

k-yle commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator Author

Is this part in the code already?

yeah, right now iD doesn't delete any fields when changing presets.

So the only change is to the 4th bullet point.

@tordans

tordans commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator

If we release this, we should look into adding a recommendation in the docs (probably schema builder) to hint at other apps that this is the common handling of this case. (Note to self)

@tyrasd tyrasd left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like the most sensible thing do do.

I noticed that none of the tests seems to cover the case for a tag which does not exist in either preset… Shall we maybe add a test for that case while we're at it? //edit: added this in 6f92a29

Comment thread modules/actions/change_preset.js Resolved
@matkoniecz

Copy link
Copy Markdown
Collaborator

@k-yle

k-yle commented Mar 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

fixes openstreetmap/id-tagging-schema#2069

how it does it?

If we add a field for water=* to the Lateral Water Hazard preset, then the tag will be preserved when you switch between the presets Lake and Lateral Water Hazard.

So it requires a change in this repo and iD-tagging-schema to fully fix that issue

@matkoniecz

Copy link
Copy Markdown
Collaborator

I expected that openstreetmap/id-tagging-schema#951 would be also fixed, but it still requires fiddling with paths.

@matkoniecz

Copy link
Copy Markdown
Collaborator

StreetComplete and CoMaps have their own manually curated logic.StreetComplete and CoMaps have their own manually curated logic.

I wonder whether it also should be partially used to purge things like "fhrs:.*", "old_fhrs:.*", "fvst:.*", "ncat", "nat_ref", "gnis:.*", "winkelnummer", "type:FR:FINESS", "type:FR:APE", "kvl_hro:amenity", "ref:DK:cvr(:.*)?", "certifications?", "transiscope", "opendata:type", "local_ref", "official_ref", "ref:thw", "ref:nav", "ref:GR:kepId", "ref:bufa", "ref:walmart", "ref:rspo", "ref:cue", "ref:regon", "ref:BY:trade_register", "ref:vb", "ref:comfort", "ref:bademilj.", "ref:HU:vatin", "ref:HU:company", "ref:ico", "ref:scoutingnl", "ref:anlegg", "ref:FR:sport_equip", "ref:FR:RNA", "ref:FR:CRTA", "ref:charity",

This branch was successfully deployed

1 active deployment
pr-preview-11696 — b0ab22b7 Deployed Mar 16, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

id-tagging-schema An issue related to the id-tagging-schema repo preset An issue with an OpenStreetMap preset or tag

Projects

None yet

4 participants