Commit 95300cf9915bb13392d536b766cc20c976d8c682
1 parent
55f1f6d9
plugin update
Showing
1 changed file
with
15 additions
and
3 deletions
datalets/leafletjs-datalet/leafletjs-datalet.html
@@ -89,16 +89,28 @@ Example: | @@ -89,16 +89,28 @@ Example: | ||
89 | L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images'; | 89 | L.Icon.Default.imagePath = 'http://services.routetopa.eu/DEEalerProvider/COMPONENTS/datalets/leafletjs-datalet/leafletsjs/images'; |
90 | 90 | ||
91 | var coordinates = []; | 91 | var coordinates = []; |
92 | + var coordinates_index = 0; | ||
92 | var isArray = t.data[0].data[0].constructor === Array; | 93 | var isArray = t.data[0].data[0].constructor === Array; |
93 | 94 | ||
94 | for(var i=0; i<t.data[0].data.length; i++) | 95 | for(var i=0; i<t.data[0].data.length; i++) |
95 | { | 96 | { |
96 | if(isArray) | 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 | else | 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 | if(t.data.length > 2) | 115 | if(t.data.length > 2) |
104 | { | 116 | { |