Development of the drawing mechanism, displaying stops with the data imported from the database.

This commit is contained in:
Jan Kiljanski
2024-06-11 23:04:22 +02:00
parent 1dd906a87f
commit b90acfcebe
4 changed files with 68 additions and 39 deletions

View File

@@ -132,6 +132,9 @@
let tripsData = [];
let stopsData = [];
let stopTimesData = [];
// Variable set to true if a new shape is being added.
let addingNewShape = false;
let currentlyAddedPolyline = null;
// Holder of currently inspected shape ID value
let currentShapeIDs = {};
currentShapeIDs["routes"] = [];
@@ -178,12 +181,28 @@
}
function importGTFS() {
stops = JSON.parse('{{ stops|safe }}');
// Import stops
shapes["stops"] = JSON.parse('{{ stops|safe }}');
for (const id in shapes["stops"]) {
//console.log("id: ", id);
let stop_lat = shapes["stops"][id]["stop_lat"];
let stop_lon = shapes["stops"][id]["stop_lon"];
if (stop_lat == undefined || stop_lon == undefined) {
continue;
}
else {
//console.log("stop_lat: ", stop_lat);
//console.log("stop_lon: ", stop_lon);
//console.log(shapes["stops"][stop["stop_id"]]);
addClickablePoint([stop_lat, stop_lon], id);
}
}
routes = JSON.parse('{{ routes|safe }}');
console.log("routes: ", routes);
timetable = JSON.parse('{{ timetable|safe }}');
console.log("timetable: ", timetable);
alert("Import existing GTFS clicked");
// Logic to import existing GTFS would go here
}
</script>
</body>