Here you can see the flows for the distance and map. In the first one, the 3 global arrays are initialised as well as the max size (12) in Variable Globale
like this:
(the check_0
variable is used to initialise the global variables once in the entirety of the project, I don't know how to do that otherwise)
global.set("check_0",{"cpt":0});
if(global.get("check_0")===0){
global.set("latitude1",0);
global.set("longitude1",0);
global.set("latitude2",0);
global.set("longitude2",0);
global.set("latitude3",0);
global.set("longitude3",0);
global.set("taille_max",12);
global.set("tab_historique1", []);
global.set("tab_historique2", []);
global.set("tab_historique3", []);
}
global.set("check_0",1);
return msg;
The data (latitude and longitude 1, 2 and 3) are stored in the 3 arrays so that the most recent values are stocked in the end of the arrays. That is done in the Set_Coordonnées
nodes, but I don't think it's important to show it.
In the Map flow, we have successfully showed a map with a path of points. The problem is when I try to get the tab_historique1
array. Curious fact, I don't have a problem when I try to get the latitude or longitude variables.
<!DOCTYPE html>
<html>
<head>
<title>Supply Chain</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAxuxffizWf5rlO5UHZE4Rt4POasJY0om4"></script>
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
<style type="text/css" media="screen">
#map {
position:absolute;
top: 0; bottom: 0; left: 0; right: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
$(document).ready(function(){
var MAP_ZOOM = 14;//14
var MARKER_SIZE = 24;
// set center of map
var map = new google.maps.Map(document.getElementById('map'), {
zoom: MAP_ZOOM,
center: {lat: 43.6239695, lng: 7.0509146}, //{lat: 43.737450, lng: 7.048596}
//mapTypeId: 'satellite'
mapTypeId: 'terrain'
});
var hist11 = {{global.latitude1}}; // does not get error
var hist11 = {{global.tab_historique1}}; // does get error
// set path of coordinates
var flightPlanCoordinates = [
{lat: 43.6234, lng: 7.0523},
{lat: 43.6235, lng: 7.0524},
{lat: 43.6236, lng: 7.0523},
{lat: 43.6238, lng: 7.0525}
];
var flightPath11 = new google.maps.Polyline({
path: flightPlanCoordinates,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath11.setMap(map);
});
</script>
</body>
</html>
So if you comment the global array line, you can see a map in the dashboard, otherwise it's just a blanc square.
I have to say that the Map flow was given to us by our professor and the Map
node is the only node there that I have modified.