Choose a better preset type when generating JOSM presets
(closes #5784)
This commit is contained in:
parent
c5764dcd8e
commit
f2993fa7f5
1 changed files with 19 additions and 1 deletions
|
@ -394,11 +394,29 @@ function buildJOSMPresets() {
|
|||
if (k !== kPrev) kGroup = tGroup.ele('group').att('name', k);
|
||||
if (v !== vPrev) vGroup = kGroup.ele('group').att('name', v);
|
||||
|
||||
// Choose allowable geometries for the category
|
||||
let presetType;
|
||||
if (t === 'flags') {
|
||||
presetType = 'node';
|
||||
} else if (k === 'route') {
|
||||
if (v === 'ferry') { // Ferry hack! ⛴
|
||||
presetType = 'way,closedway,relation';
|
||||
} else {
|
||||
presetType = 'relation';
|
||||
}
|
||||
} else if (k === 'power' && (v === 'line' || v === 'minor_line')) {
|
||||
presetType = 'way,closedway';
|
||||
} else if (k === 'power' && (v === 'pole' || v === 'tower')) {
|
||||
presetType = 'node';
|
||||
} else {
|
||||
presetType = 'node,closedway,multipolygon'; // default for POIs
|
||||
}
|
||||
|
||||
items.forEach(item => {
|
||||
let preset = vGroup
|
||||
.ele('item')
|
||||
.att('name', item.displayName)
|
||||
.att('type', 'node,closedway,multipolygon');
|
||||
.att('type', presetType);
|
||||
|
||||
for (const osmkey in item.tags) {
|
||||
preset.ele('key').att('key', osmkey).att('value', item.tags[osmkey]);
|
||||
|
|
Loading…
Add table
Reference in a new issue