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'; }