From ec9d00c597eba07b4b00ad078adb9bb91c779ab1 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 21 Feb 2018 15:07:44 -0600 Subject: [PATCH] Fix map centering --- public/assets/system/js/system.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/assets/system/js/system.js b/public/assets/system/js/system.js index 410cfd6a..5360d736 100644 --- a/public/assets/system/js/system.js +++ b/public/assets/system/js/system.js @@ -137,7 +137,10 @@ const phpvms = (function() { }).addTo(map); geodesicLayer.geoJson(opts.planned_route_line); - map.fitBounds(geodesicLayer.getBounds()); + + try { + map.fitBounds(geodesicLayer.getBounds()); + } catch (e) { console.log(e); } // Draw the route points after if (opts.route_points !== null) { @@ -168,7 +171,12 @@ const phpvms = (function() { }).addTo(map); geodesicLayer.geoJson(opts.actual_route_line); - map.fitBounds(geodesicLayer.getBounds()); + + try { + map.fitBounds(geodesicLayer.getBounds()); + } catch (e) { + console.log(e); + } } if (opts.actual_route_points !== null && opts.actual_route_points.features.length > 0) {