ol.interaction.Draw를 사용하여 맵에 점을 그립니다. "draw"아이콘을 클릭 할 때마다 사용자가 하나의 고유 한 점을 그릴 수있게하려고합니다. 그 방법에 대한 아이디어가 있으십니까?Openlayer3에서 하나의 그리기 기능 허용
function addInteraction() {
draw = new ol.interaction.Draw({
source: sourceComments,
type: "Point"
});
draw.on('drawend',
function(evt) {
// unset sketch
sketch = null;
var allFeatures = comments.getSource().getFeatures();
var format = new ol.format.GeoJSON();
document.getElementById('geometry').value = JSON.stringify(format.writeFeatures(allFeatures), null, 4);
}, this);
map.addInteraction(draw);
}
감사 :
여기의 상호 작용에 대한 코드입니다!