You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -386,6 +386,67 @@ For example,
386
386
}
387
387
```
388
388
389
+
##### `relation`
390
+
391
+
For relations, this object describes which roles are allowed, which tags are required for each role, and other constraints related to relation roles.
392
+
393
+
*`relation.id` – a string. This is the “permanent relation type ID”, it must match the value of [permanent relation type ID<sup><code>P41</code></sup>](https://osm.wiki/Property:P41) in the OSM wiki’s wikibase system.
394
+
*`relation.allowDuplicateMembers` – a boolean. Set to `true` if the same OSM feature is allowed to appear multiple times in the relation's members.
395
+
*`relation.members` – an array of objects, which lists every relation role that is permitted as a member (see below).
396
+
397
+
A full example looks like this:
398
+
399
+
```jsonc
400
+
// type/restriction/no_u_turn.json
401
+
{
402
+
"relation": {
403
+
"id":"restriction", // the value of https://osm.wiki/Property:P41 from the matching
404
+
// item, in this case https://wiki.openstreetmap.org/wiki/Item:Q16054. Note that multiple
405
+
// relation entries may have the same `id` value.
406
+
"allowDuplicateMembers":true,
407
+
"members": [
408
+
{
409
+
"role":"from", // The relation role. An empty string is allowed.
410
+
"roleLabel":"From", // The label for the role, in the default language. An empty string is allowed.
411
+
"geometry": ["line"], // If not specified, any geometry is allowed.
412
+
"matchTags": [
413
+
// Describes which tags the member must have, if it has this role.
414
+
// `*` can be used as a tag value.
415
+
// If multiple array items are specified, only 1 needs to match.
416
+
// If this property is not specified, then any tags are allowed
417
+
{ "highway":"*" }
418
+
],
419
+
"min":1, // The minimum number of times that this role must appear in the relation.
420
+
"max":1// The maximum number of times that this role must appear in the relation.
421
+
},
422
+
{
423
+
"role":"via",
424
+
"roleLabel":"Via",
425
+
"geometry": ["vertex", "line"],
426
+
"min":1
427
+
},
428
+
{
429
+
"role":"to",
430
+
"roleLabel":"To",
431
+
"geometry": ["line"],
432
+
"matchTags": [{ "highway":"*" }],
433
+
"min":1,
434
+
"max":1
435
+
}
436
+
]
437
+
}
438
+
}
439
+
```
440
+
441
+
##### `relationCrossReference`
442
+
443
+
To avoid repeating the [`relation` object](#relation) in several presets, you can use `relationCrossReference` to reference another preset.
444
+
445
+
For example:
446
+
```js
447
+
"relationCrossReference":"{type/route}"
448
+
```
449
+
389
450
### Fields
390
451
391
452
Fields are reusable form elements that can be associated with presets.
Copy file name to clipboardExpand all lines: schemas/preset.json
+75-1Lines changed: 75 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -135,8 +135,82 @@
135
135
},
136
136
"minProperties": 1,
137
137
"additionalProperties": false
138
+
},
139
+
"relation": {
140
+
"$ref": "#/$defs/RelationSchema"
141
+
},
142
+
"relationCrossReference": {
143
+
"description": "A preset can reference the relation schema from another preset, instead of defining the same schema again. If present, then the `relation` property must not appear.",
144
+
"type": "string",
145
+
"pattern": "^\\{.+\\}$"
138
146
}
139
147
},
140
148
"additionalProperties": false,
141
-
"required": ["name", "geometry", "tags"]
149
+
"required": ["name", "geometry", "tags"],
150
+
"$defs": {
151
+
"RelationSchema": {
152
+
"type": "object",
153
+
"properties": {
154
+
"id": {
155
+
"type": "string",
156
+
"description": "The “permanent relation type ID”, this should match the value of https://osm.wiki/Property:P41 in the OSM wiki’s wikibase system."
157
+
},
158
+
"allowDuplicateMembers": {
159
+
"type": "boolean",
160
+
"description": "Set to `true` if the relation can contain the same member multiple times."
161
+
},
162
+
"members": {
163
+
"type": "array",
164
+
"items": {
165
+
"type": "object",
166
+
"properties": {
167
+
"role": {
168
+
"type": "string",
169
+
"description": "The relation role. An empty string is allowed."
170
+
},
171
+
"roleLabel": {
172
+
"type": "string",
173
+
"description": "The label for the role, in the default language. An empty string is allowed."
174
+
},
175
+
"geometry": {
176
+
"type": "array",
177
+
"uniqueItems": true,
178
+
"items": {
179
+
"$ref": "field.json#/$defs/Geometry"
180
+
},
181
+
"description": "If not specified, any geometry is allowed"
182
+
},
183
+
"matchTags": {
184
+
"type": "array",
185
+
"items": {
186
+
"type": "object",
187
+
"additionalProperties": {
188
+
"type": "string"
189
+
},
190
+
"minProperties": 1
191
+
},
192
+
"examples": [
193
+
[{ "a": 1, "b": 2 }],
194
+
[{ "a": 1 }, { "b": 2 }]
195
+
],
196
+
"description": "`*` can be used as a tag value. If multiple array items are specified, only 1 needs to match. If not specified, then any tags are allowed"
197
+
},
198
+
"min": {
199
+
"type": "integer",
200
+
"description": "If unspecified, there is no minimum for how many times this role can appear in the relation"
201
+
},
202
+
"max": {
203
+
"type": "integer",
204
+
"description": "If unspecified, there is no maximum for how many times this role can appear in the relation"
0 commit comments