|
|
@@ -190,6 +190,7 @@ function update_buses(json_gtfs) {
|
|
|
let lonlat = [ lon , lat ];
|
|
|
let merc = fromLonLat(lonlat);
|
|
|
|
|
|
+ if (typeof _icon[ii] === "undefined") { continue; }
|
|
|
|
|
|
_icon[ii].feature.getGeometry().setCoordinates(merc);
|
|
|
|
|
|
@@ -231,6 +232,7 @@ function fetch_gtfs_vehicle_position() {
|
|
|
//--
|
|
|
|
|
|
function update_route_layer(geojson) {
|
|
|
+ if (!geojson) { return; }
|
|
|
var route_points = geojson.features[0].geometry.coordinates;
|
|
|
var merc_points = [];
|
|
|
for (let ii=0; ii<route_points.length; ii++) {
|
|
|
@@ -259,6 +261,7 @@ function update_route_layer(geojson) {
|
|
|
}
|
|
|
|
|
|
function update_stop_layer(geojson) {
|
|
|
+ if (!geojson) { return; }
|
|
|
let stop_points = geojson.features[0].properties.route_stops;
|
|
|
|
|
|
let merc_points = [];
|
|
|
@@ -330,9 +333,17 @@ function fetch_geojson(url) {
|
|
|
|
|
|
//--
|
|
|
|
|
|
+function _resize() {
|
|
|
+ let h = $(window).height();
|
|
|
+ let m = document.getElementById("map");
|
|
|
+ m.style.height = (h-10) + "px";
|
|
|
+}
|
|
|
+
|
|
|
function init() {
|
|
|
setInterval(fetch_gtfs_vehicle_position, 1000);
|
|
|
setTimeout( function() { fetch_geojson("geojson/test_route.geojson"); }, 100);
|
|
|
+
|
|
|
+ $(window).on('resize', _resize);
|
|
|
}
|
|
|
|
|
|
init();
|