I have a 2 dimensional array location which contains the latitudes and longitudes that I would like to present in my heatmap. I created 2 additional arrays from location:
for(var i=0;i<location.length;i++){
lat_array=location[i][0]
long_array=location[i][1]
};
let testData = {
max: 8,
data: [{lat:lat_array, lng:long_array, count:8}]
}; //Count is random
let cfg={
"radius": 40,
"maxOpacity": 0.8,
"scaleRadius": false,
"useLocalExtrema": false,
latField: 'lat',
lngField:'lng',
valueField:'count'
};
let heatmapLayer = new HeatmapOverlay(cfg);
mymap.addLayer(heatmapLayer);
heatmapLayer.setData(testData);
When I run the page I get an error message saying that the longitude and latitude cannot be arrays and I tried running it with specific values (lat_array[1],long_array[1]) and it worked. So I am trying to figure out how to add all of the latitudes and longitudes in the location array which its values vary each time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…