summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2015-03-04 10:43:48 +0000
committerChristopher Baines <cb15g11@soton.ac.uk>2015-03-04 10:43:48 +0000
commit53b9706ccbe5d08845728c367f76ad6756549b2b (patch)
tree932808549226b2f3025090718413fdb2573841e9
parent3c67959ced37b920ac95b0a16b45fb49e53a16a3 (diff)
downloadleaflet-soton-53b9706ccbe5d08845728c367f76ad6756549b2b.tar
leaflet-soton-53b9706ccbe5d08845728c367f76ad6756549b2b.tar.gz
Patch data creation
Do not fail if bus stop URI's are missing.
-rwxr-xr-xcreate-data.js34
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);