当我使用多边形时,有一个函数geometry.getInteriorPoint()。内点是什么意思。这是多边形的哪一点?
我希望您使用选择交互来添加功能,但是e.coordinate显示undefined。
var select = new ol.interaction.Select({
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#0288D1',
width: 2
})
})
});
map.addInteraction(select);
select.on('select', function(e) {
var feat = new ol.Feature({
geometry: new ol.geom.Point(e.coordinate),
style: style1
});
alert(e.coordinate);
feat.setStyle(style1);
layerVector.getSource().addFeature(feat);
});
Run Code Online (Sandbox Code Playgroud)
如果有人知道原因,请告诉我在我通过这种选择交互方式单击查看器时如何获取坐标。
openlayers-3 ×2