I need to build an array with a collection of co-ordinates.. the example shows the array built like this..
stops = [{"Geometry":{"Latitude":51.507937,"Longitude":-0.076188}},
{"Geometry":{"Latitude":51.51168,"Longitude":-0.114155}},
{"Geometry":{"Latitude":51.5010063,"Longitude":-0.041407}}] ;
I am trying to build a loop that reads co-ords from elsewhere and pushes them in the stops array.. this is what i have so far but i know its wrong..
var x = document.getElementsByClassName("postcode");
for (i = 0; i < x.length; i++) {
postcode = x[i].innerText;
lon = getLon(postcode);
lat = getLat(postcode);
myarray = [{"Latitude":lon,"Longitude":lat}];
stops.push([{"Geometry":myarray}]);
}