Leaflet js Uncaught TypeError:无法读取null的属性“ 0”

时间:2019-04-03 11:51:04

标签: javascript leaflet

当我为坐标obj硬编码时,它可以工作并绘制polyline,但是当我尝试通过looparray时,会出现此错误

  

leaflet.js:5未捕获的TypeError:无法读取null的属性“ 0”

at e._projectLatlngs (leaflet.js:5)
at e._projectLatlngs (leaflet.js:5)
at e._project (leaflet.js:5)
at e._onZoomEnd (leaflet.js:5)
at e.fire (leaflet.js:5)
at e._moveEnd (leaflet.js:5)
at e.<anonymous> (leaflet.js:5)

,但是在这种情况下,console.log显示了像这样的data Number(obj[2][0].geometry.coordinates[0][0][0])显示了我无法弄清楚我在循环中出错的位置的坐标。代码显示问题的jsbin

jsbin with code

0 个答案:

没有答案