mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Merge pull request #8627 from openstreetmap/nsi_route_master
Treat route_master relations like route relations for matching to NSI
This commit is contained in:
+21
-7
@@ -163,7 +163,7 @@ function loadNsiData() {
|
||||
// and fallbacks like
|
||||
// "amenity/yes"
|
||||
// excluding things like
|
||||
// "highway", "surface", "ref", etc.
|
||||
// "tiger:reviewed", "surface", "ref", etc.
|
||||
//
|
||||
// Arguments
|
||||
// `tags`: `Object` containing the feature's OSM tags
|
||||
@@ -182,13 +182,16 @@ function gatherKVs(tags) {
|
||||
const osmvalue = tags[osmkey];
|
||||
if (!osmvalue) return;
|
||||
|
||||
const vmap = _nsi.kvt.get(osmkey);
|
||||
if (!vmap) return;
|
||||
// Match a 'route_master' as if it were a 'route' - name-suggestion-index#5184
|
||||
if (osmkey === 'route_master') osmkey = 'route';
|
||||
|
||||
if (osmvalue !== 'yes') {
|
||||
primary.add(`${osmkey}/${osmvalue}`);
|
||||
} else {
|
||||
alternate.add(`${osmkey}/${osmvalue}`);
|
||||
const vmap = _nsi.kvt.get(osmkey);
|
||||
if (!vmap) return; // not an interesting key
|
||||
|
||||
if (vmap.get(osmvalue)) { // Matched a category in NSI
|
||||
primary.add(`${osmkey}/${osmvalue}`); // interesting key/value
|
||||
} else if (osmvalue === 'yes') {
|
||||
alternate.add(`${osmkey}/${osmvalue}`); // fallback key/yes
|
||||
}
|
||||
});
|
||||
|
||||
@@ -228,6 +231,9 @@ function identifyTree(tags) {
|
||||
const osmvalue = tags[osmkey];
|
||||
if (!osmvalue) return;
|
||||
|
||||
// Match a 'route_master' as if it were a 'route' - name-suggestion-index#5184
|
||||
if (osmkey === 'route_master') osmkey = 'route';
|
||||
|
||||
const vmap = _nsi.kvt.get(osmkey);
|
||||
if (!vmap) return; // this key is not in nsi
|
||||
|
||||
@@ -427,6 +433,8 @@ function _upgradeTags(tags, loc) {
|
||||
}
|
||||
});
|
||||
|
||||
// Match a 'route_master' as if it were a 'route' - name-suggestion-index#5184
|
||||
const isRouteMaster = (tags.type === 'route_master');
|
||||
|
||||
// Gather key/value tag pairs to try to match
|
||||
const tryKVs = gatherKVs(tags);
|
||||
@@ -521,6 +529,12 @@ function _upgradeTags(tags, loc) {
|
||||
// Do the tag upgrade
|
||||
Object.assign(newTags, item.tags, keepTags);
|
||||
|
||||
// Swap `route` back to `route_master` - name-suggestion-index#5184
|
||||
if (isRouteMaster) {
|
||||
newTags.route_master = newTags.route;
|
||||
delete newTags.route;
|
||||
}
|
||||
|
||||
// Special `branch` splitting rules - IF..
|
||||
// - NSI is suggesting to replace `name`, AND
|
||||
// - `branch` doesn't already contain something, AND
|
||||
|
||||
Reference in New Issue
Block a user