【发布时间】:2023-01-30 22:00:45
【问题描述】:
使用以下代码,我试图从地图上的多边形绘图中获取坐标,但我收到此控制台错误,而不是“Uncaught TypeError: feature.getId is not a function”
const drawInteraction = new Draw({
type:'Polygon',
freehand:true
})
map.addInteraction(drawInteraction);
drawInteraction.on('drawend',function(e){
let parser= new GeoJSON();
let drawnFeatures = parser.writeFeatureObject([e.feature]);
console.log(drawnFeatures);
})
【问题讨论】:
-
你在哪里实现了 feature.getId?
标签: javascript