Commit 38742d5a7e673807cb0a0914b2fd89b57206a034

Authored by Renato De Donato
2 parents 0f4f5f1b 95300cf9

Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS

datalets/leafletjs-datalet/leafletjs-datalet.html
... ... @@ -89,16 +89,28 @@ Example:
89 89 L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images';
90 90  
91 91 var coordinates = [];
  92 + var coordinates_index = 0;
92 93 var isArray = t.data[0].data[0].constructor === Array;
93 94  
94 95 for(var i=0; i<t.data[0].data.length; i++)
95 96 {
96 97 if(isArray)
97   - coordinates.push([parseFloat(t.data[0].data[i][0]), parseFloat(t.data[0].data[i][1])]);
  98 + {
  99 + if(!isNaN(t.data[0].data[i][0]) && !isNaN(t.data[0].data[i][1]))
  100 + coordinates.push([parseFloat(t.data[0].data[i][0]), parseFloat(t.data[0].data[i][1])]);
  101 + else
  102 + continue;
  103 + }
98 104 else
99   - coordinates.push([parseFloat(t.data[0].data[i]), parseFloat(t.data[1].data[i])]);
  105 + {
  106 + if(!isNaN(t.data[0].data[i]) && !isNaN(t.data[1].data[i]))
  107 + coordinates.push([parseFloat(t.data[0].data[i]), parseFloat(t.data[1].data[i])]);
  108 + else
  109 + continue;
  110 + }
100 111  
101   - var marker = L.marker([coordinates[i][0], coordinates[i][1]]).addTo(t._component.map);
  112 + var marker = L.marker([coordinates[coordinates_index][0], coordinates[coordinates_index][1]]).addTo(t._component.map);
  113 + coordinates_index++;
102 114  
103 115 if(t.data.length > 2)
104 116 {
... ...