Hi all
I am using Javascript to create a Leaflet map in an HTMLViewer. This all works with no issues. Where I am running into a problem is trying to add multiple markers to the map. If I execute my JS code via Xojo I am only getting one marker. However if I run the same code in the Chrome console I get all the points I expect. It appears that for whatever reason my loop in JS is not running when executed in Xojo. Here is the JS code I am using:
var locations = [
["LOCATION_0", 37.42228990140251,-122.0822035425683],
["LOCATION_1", 37.4220033612141,-122.084075],
["LOCATION_2", 37.42156927867553,-122.0857667006183],
["LOCATION_3", 37.42243077405461,-122.0856545755255]
];
var map = L.map('map').setView([37.42228990140251,-122.0822035425683], 15);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
for (var i = 0; i < locations.length; i++) {
marker = new L.marker([locations[i][1], locations[i][2]])
.bindPopup(locations[i][0])
.addTo(map);
}