javascript - Mapbox 错误:“无法读取未定义的属性 '0'”
问题描述
我正在使用构建网络地图,mapbox gl js
并且一切正常,但现在不知从何而来我收到此错误:
错误 {消息:“无法读取未定义的属性 '0'”}
虽然它在一天前工作并且代码没有任何变化:
var url = 'http://localhost:3000/data';
map.addSource('features', {
type: 'geojson',
data: url
});
map.addLayer({
'id': 'features-layer',
'type': 'circle',
'source': 'features',
'paint': {
'circle-color': '#ccc',
'circle-radius': 10,
'circle-opacity': 0.6,
'circle-stroke-width': 0.6,
'circle-stroke-color': 'black',
}
});
解决方案
我认为这是因为几何对象中的“坐标”一词拼写不正确,请检查第 24 行的第一个屏幕截图
推荐阅读
- r - R Predict 产生的值不同于手动计算
- javascript - 如何在 JavaScript 中构建 Spring 表单
- java - RazorPay 与 React JS 和 Java 应用程序集成
- javascript - JavaScript输入值不断消失
- python - isinstance 替代覆盖默认值
- java - 如何反转订单?
- sql - 从 postgreSQL 中的存储过程返回结果集
- sql - 如何在 postgresql 中的 with 子句之后使用 delete 子句?
- node.js - 护照本地策略 req.isAuthenticated() 始终为 false
- python - 安装成功后导入sip出现问题