Don't copy building part or indoor tags to node when extracting point from a way or relation (close #7862)

This commit is contained in:
Quincy Morgan
2020-08-16 17:18:16 -04:00
parent 4224e39793
commit 484f54f982
+20 -2
View File
@@ -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';
}