繁体   English   中英

无法向Leaflet.js热图添加点

[英]Unable to add points to Leaflet.js heatmap

我正在使用Leaflet.js和Leaflet.heat。 当我添加点时,我得到“无法获取未定义或空引用的属性纬度”。 当我在控制台中打印point的值并将其粘贴到代码中时,它可以工作。 我究竟做错了什么?

 setTimeout(function () { if (i >= num_frames) { return; } try { var points = "[" + array_all_snapshot[i] + "]"; console.log(points); var points = array_all_snapshot[i]; var heat = L.heatLayer(points, { maxZoom: 10 }) .addTo(map); } catch (e) { console.log(array_all_snapshot[i]); console.log(e.toString()); } i += 1; requestAnimationFrame(function () { repeatOften(i); }); }, 11 ); 

发现我的错误。 我不得不JSON.parse()要点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM