diff options
-rwxr-xr-x | create-data.js | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/create-data.js b/create-data.js index 4f224bf..d566704 100755 --- a/create-data.js +++ b/create-data.js @@ -817,18 +817,20 @@ function createBuildingParts(buildings, callback) { getDoors(buildingPart, function(err, doors) { buildingPart.properties.doors = []; - doors.forEach(function(door) { - if (!(door.id in doorsToRooms)) { - doorsToRooms[door.id] = [ buildingPart ]; - } else { - doorsToRooms[door.id].push(buildingPart); - } - doorsById[door.id] = door; - - buildingParts.push(door); - - buildingPart.properties.doors.push(door.id); - }); + if (typeof(doors) !== "undefined") { + doors.forEach(function(door) { + if (!(door.id in doorsToRooms)) { + doorsToRooms[door.id] = [ buildingPart ]; + } else { + doorsToRooms[door.id].push(buildingPart); + } + doorsById[door.id] = door; + + buildingParts.push(door); + + buildingPart.properties.doors.push(door.id); + }); + } callback(); }); @@ -1549,6 +1551,12 @@ function processRoute(route, routeMaster, stopAreaRoutes, callback) { var stopURIs = areas.map(function(area) { var uri = area.tags.uri; + if (uri == null) { + console.warn("null uri for area " + JSON.stringify(area)); + + return uri; + } + if (uri.indexOf("http://transport.data.gov.uk/id/stop-point/") === 0) { uri = "http://id.southampton.ac.uk/bus-stop/" + uri.slice(43); } else { @@ -1830,7 +1838,7 @@ function createBusStop(stopArea, routes, callback) { var uri = stopArea.tags.uri; - if (uri.indexOf("http://transport.data.gov.uk/id/stop-point/") === 0) { + if (uri != null && uri.indexOf("http://transport.data.gov.uk/id/stop-point/") === 0) { uri = "http://id.southampton.ac.uk/bus-stop/" + uri.slice(43); } else { console.warn("Unrecognised bus stop uri " + uri); |