I am trying to add waypoints from a variable to a leaflet map. The resulting variable split_route1 is formatted correctly and when I hard-code the waypoints from the console log results, the waypoints render fine. When I try to use the var splitroute1 I get an error: TypeError: t is null (leaflet.js (line 6, col 17396))
function splitroute(route1){ split_route1 = ''; for (x = 0; x < route1.length ; x++) { split_route1 +='L.latLng(' + route1[x].ordered_locs.displayLatLng.lat + ',' + route1[x].ordered_locs.displayLatLng.lng + '),' }console.log(split_route1)L.Routing.control({ waypoints: [ split_route1 ], routeWhileDragging: true}).addTo(map2); }
أكثر...
function splitroute(route1){ split_route1 = ''; for (x = 0; x < route1.length ; x++) { split_route1 +='L.latLng(' + route1[x].ordered_locs.displayLatLng.lat + ',' + route1[x].ordered_locs.displayLatLng.lng + '),' }console.log(split_route1)L.Routing.control({ waypoints: [ split_route1 ], routeWhileDragging: true}).addTo(map2); }
أكثر...