From d272b97f785ae36135258d1097195b13e80405db Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 20 Jun 2014 23:40:52 +0100 Subject: Process building entrances --- create-data.js | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'create-data.js') diff --git a/create-data.js b/create-data.js index 3c3ec24..420aa94 100755 --- a/create-data.js +++ b/create-data.js @@ -493,12 +493,15 @@ function createBuildingParts(buildings, callback) { // get the buildingParts and buildingRelations from the database // - buildingParts are the ways tagged with buildingpart // - buildingRelations are all the building relations - async.parallel([getBuildingParts, getBuildingRelations], + async.parallel([getBuildingParts, getBuildingEntrances, getBuildingRelations], function(err, results) { // The objects in this array are modified var buildingParts = results[0]; - var buildingRelations = results[1]; + var buildingEntrances = results[1]; + var buildingRelations = results[2]; + + buildingParts.push.apply(buildingParts, buildingEntrances); async.parallel([ // for each room, find the features, contents and images @@ -521,7 +524,13 @@ function createBuildingParts(buildings, callback) { part.properties.level = part.properties.level[0]; } } else { - console.warn("unknown level " + JSON.stringify(part.properties.center)); + var loc; + if (part.geometry.type === "Point") { + loc = part.geometry.coordinates; + } else { + loc = part.properties.center; + } + console.warn("unknown level " + JSON.stringify(loc)); } }); @@ -538,7 +547,6 @@ function createBuildingParts(buildings, callback) { async.eachSeries(buildingParts, function(buildingPart, callback) { if (buildingPart.properties.buildingpart === "room") { getDoors(buildingPart, function(err, doors) { - console.log(JSON.stringify(doors, null, 4)); buildingParts.push.apply(buildingParts, doors); callback(); }); @@ -565,7 +573,9 @@ function getBuildingPartMemberRefs(levelRelation, callback) { for (var i=0; i