Skip to content

Conversation

k-yle
Copy link
Collaborator

@k-yle k-yle commented Dec 20, 2024

Closes #134

This is my proposal for a schema to define the roles of a relation. In summary:

  • presets can have a new field called relation
  • to avoid duplication, there is also relationCrossReference, similar to stringsCrossReference
  • each role is defined with a default (en-US) label, just like presets & fields.

Example for type=boundary:

{
  "relation": {
    "allowDuplicateMembers": false,
    "members": [
      {
        "roles": { "inner": "Inner" },
        "geometry": ["line", "area"],
        // no matchTags
      },
      {
        "roles": { "outer": "Outer" },
        "geometry": ["line", "area"],
        // no matchTags
        "min": 1
      },
      {
        "roles": { "admin_centre": "Capital", "label": "Label" },
        "geometry": ["point", "vertex"],
        "matchTags": [{ "place": "*" }],
        "max": 1
      }
    ]
  }
}

Regarding matchTags:

  • (no value) means any tags
  • [{}] also means any tags (but this is weird, just exclude matchTags)
  • [] means no tags (it will never match, this is unhelpful)
  • [{ a: 1, b: 2 }] means a=1 AND b=2
  • [{ a: 1 }, { b: 2 }] means a=1 OR b=2

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

Thanks!

@k-yle
Copy link
Collaborator Author

k-yle commented Jul 22, 2025

updated the PR description about matchTags. Instead of the confusing [{}] syntax, you can just omit matchTags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Presets should enumerate expected roles
4 participants