From 484f54f9821bd99cd144e75cfd924f5120fb3b0d Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Sun, 16 Aug 2020 17:18:16 -0400 Subject: [PATCH] Don't copy building part or indoor tags to node when extracting point from a way or relation (close #7862) --- modules/actions/extract.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/actions/extract.js b/modules/actions/extract.js index 82fb1ccf0..0db93c174 100644 --- a/modules/actions/extract.js +++ b/modules/actions/extract.js @@ -50,7 +50,18 @@ export function actionExtract(entityID) { extractedLoc = entity.extent(graph).center(); } - var isBuilding = entity.tags.building && entity.tags.building !== 'no'; + var indoorAreaValues = { + area: true, + corridor: true, + elevator: true, + level: true, + room: true + }; + + var isBuilding = (entity.tags.building && entity.tags.building !== 'no') || + (entity.tags['building:part'] && entity.tags['building:part'] !== 'no'); + + var isIndoorArea = fromGeometry === 'area' && entity.tags.indoor && indoorAreaValues[entity.tags.indoor]; var entityTags = Object.assign({}, entity.tags); // shallow copy var pointTags = {}; @@ -71,6 +82,10 @@ export function actionExtract(entityID) { key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue; } + // leave `indoor` tag on the area + if (isIndoorArea && key === 'indoor') { + continue; + } // copy the tag from the entity to the point pointTags[key] = entityTags[key]; @@ -79,13 +94,16 @@ export function actionExtract(entityID) { if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) { continue; + } else if (isIndoorArea && key === 'level') { + // leave `level` on both features + continue; } // remove the tag from the entity delete entityTags[key]; } - if (!isBuilding && fromGeometry === 'area') { + if (!isBuilding && !isIndoorArea && fromGeometry === 'area') { // ensure that areas keep area geometry entityTags.area = 'yes'; }