Hi, I am trying to parse my array so I can format it for a request parameter that needs to be a linestring. I am getting json from the Google directions service, which returns a bunch of arrays, see sample here:
http://maps.googleapis.com/maps/api/d...
I need to pass the lng/lat from the steps array; start_location and end_location objects
I wrote this custom js before mapping the variables:
var obj = JSON.parse(localStorage.getItem("route_array"));
for (var i = 0, j = route_array.length; i < j; i++)
var lineString = obj.routes[1].legs[4].steps[4].start_location.lng + "," + obj.routes[1].leg[4].steps[4].start_location.lat +""+ obj.routes[1].legs[4].steps[2].end_location.lng +","+ obj.routes[1].legs[4].steps[2].end_location.lat +""+
localStorage.setItem("steps[lineString]");
So I need to repeat as many times as there are pairs of lat/lon generated, and place those into the linestring format, very simple: lng","lat""lng","lat etc... any help appreciated. When I try to run the this I keep getting undefined on legs, then steps etc... thanks!