This repository was archived by the owner on Aug 7, 2026. It is now read-only.
Add optionsLocationSet for per-option combo field geo-scoping - #349
Closed
julcnx wants to merge 1 commit into
Closed
Add optionsLocationSet for per-option combo field geo-scoping#349julcnx wants to merge 1 commit into
julcnx wants to merge 1 commit into
Conversation
Field-level locationSet already restricts a whole field to a region, but combo field options have no equivalent. Adds optionsLocationSet, a map from option value to a locationSet object, so a single combo option can be offered only in specific regions while the rest of the field stays global. Kept separate from strings.options rather than nested inside it: strings go through the translation-string extraction pass and end up in a different output file, so putting geo data there would either get lost or leak into translation bundles. optionsLocationSet stays untranslated and flows straight through to the built field data, same as the existing field-level locationSet. validateOptionsLocationSet() catches keys that don't match a real option value, mirroring the existing validateTerms() pattern.
Collaborator
|
This Repo was merged into https://github.com/openstreetmap/id-tagging-schema/pulls |
Author
|
Ah, missed that this repo's being folded into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This came out of a discussion on openstreetmap/id-tagging-schema#2332, where a maintainer asked whether a single
surfacecombo option (laterite, a tropical soil type essentially absent outside a specific belt of countries) could be scoped to only the regions where it's actually relevant, rather than showing in the dropdown everywhere. Field-levellocationSetalready exists for hiding a whole field by region, but there's no equivalent for a single option inside a shared combo field likesurface, which is used across most highway presets globally.This adds
optionsLocationSet, a map from option value to alocationSetobject, following the same{include, exclude}shape as the existing field-levellocationSet. An option with no entry in the map is offered everywhere, same as today.A few design notes:
strings.optionsrather than nested inside it. Strings go through the translation-string extraction pass inbuild.jsand end up in a different output artifact (the translation bundle), so geo data placed there would either get lost or incorrectly ship inside a translated-strings file.optionsLocationSetstays untranslated and flows straight through to the built field data, the same path the existing field-levellocationSetalready takes.validateOptionsLocationSet()to catch a key that doesn't match a real option value (typo protection), mirroring the existingvalidateTerms()validation pattern.chalkywater-quality option scoped toinclude: ['GB', 'FR']/exclude: ['GB-NIR'], chosen because it's a real-ish parallel (chalk streams/geology are heavily concentrated in southern England and northern France, and Northern Ireland's geology doesn't have them), rather than an arbitrary example.This is the schema/build half of a three-repo change. A companion iD PR would teach
combo.jsto actually filter the option list using this data (it already has the exact plumbing for whole-fieldlocationSetfiltering inmodules/ui/field.js, this reuses that samelocationManager/locationSetsAt()mechanism per-option instead of per-field), and a follow-up id-tagging-schema PR would applyoptionsLocationSettolateriteonce both land. Opening this piece first since it's the smallest, self-contained one and unblocks the other two.Happy to adjust the shape or approach if you'd prefer something different, this is very much a proposal, not a claim that it's the only way to do it.