draw/modify 上的 openlayers 错误(在 vuejs 中)
openlayers error on draw/modify (in vuejs)
The code I am using is in my previous question (resolved)
交互工作完美,我的目标是获取坐标数组,也工作完美。尽管一切正常,但每次在显示区域移动鼠标时,控制台都会出现错误。它不影响功能,但显然我需要解决它...有什么想法吗?
Draw.js?ac29:579 Uncaught TypeError: Cannot read property 'getGeometry' of null
at Draw.modifyDrawing_ (Draw.js?ac29:579)
at Draw.handlePointerMove_ (Draw.js?ac29:479)
at Draw.handleEvent (Draw.js?ac29:871)
at Map.handleMapBrowserEvent (PluggableMap.js?fe37:924)
at MapBrowserEventHandler.boundListener (events.js?1e8d:41)
at MapBrowserEventHandler.dispatchEvent (Target.js?0ec0:101)
at MapBrowserEventHandler.handlePointerMove_ (MapBrowserEventHandler.js?2ad6:260)
at PointerEventHandler.boundListener (events.js?1e8d:41)
at PointerEventHandler.dispatchEvent (Target.js?0ec0:101)
at PointerEventHandler.fireNativeEvent (PointerEventHandler.js?b114:397)
我正在尝试一些非常随机的事情,但您可能想在当前代码中添加一些条件:
var modify = new Modify({source: source});
modify.on('modifyend',function(e){
if(e.features && e.features.getArray().length) { //add this line
console.log("feature id is",e.features.getArray()[0].getGeometry().getCoordinates()[0]);
}
});
The code I am using is in my previous question (resolved)
交互工作完美,我的目标是获取坐标数组,也工作完美。尽管一切正常,但每次在显示区域移动鼠标时,控制台都会出现错误。它不影响功能,但显然我需要解决它...有什么想法吗?
Draw.js?ac29:579 Uncaught TypeError: Cannot read property 'getGeometry' of null
at Draw.modifyDrawing_ (Draw.js?ac29:579)
at Draw.handlePointerMove_ (Draw.js?ac29:479)
at Draw.handleEvent (Draw.js?ac29:871)
at Map.handleMapBrowserEvent (PluggableMap.js?fe37:924)
at MapBrowserEventHandler.boundListener (events.js?1e8d:41)
at MapBrowserEventHandler.dispatchEvent (Target.js?0ec0:101)
at MapBrowserEventHandler.handlePointerMove_ (MapBrowserEventHandler.js?2ad6:260)
at PointerEventHandler.boundListener (events.js?1e8d:41)
at PointerEventHandler.dispatchEvent (Target.js?0ec0:101)
at PointerEventHandler.fireNativeEvent (PointerEventHandler.js?b114:397)
我正在尝试一些非常随机的事情,但您可能想在当前代码中添加一些条件:
var modify = new Modify({source: source});
modify.on('modifyend',function(e){
if(e.features && e.features.getArray().length) { //add this line
console.log("feature id is",e.features.getArray()[0].getGeometry().getCoordinates()[0]);
}
});