Choose a better preset type when generating JOSM presets

(closes #5784)
This commit is contained in:
Bryan Housel 2021-12-03 16:09:34 -05:00
parent c5764dcd8e
commit f2993fa7f5

View file

@ -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]);