0
我只想繪製一個多邊形,對其進行修改,然後保存該多邊形。我已經做了保存。我無法修改多邊形,因爲它捕捉。繪製並修改多邊形
這是我需要的,但我無法使它工作。 https://openlayers.org/en/latest/examples/draw-and-modify-features.html
這是我的地圖:
function map() {
map = new ol.Map({
controls: ol.control.defaults({
attributionOptions: ({
collapsible: true
})
}).extend([
scaleLineControl, new escalaControl(), new quitarContorno()
]),
logo: false, /* es global */
layers: layers,
target: 'map',
view: new ol.View({
center:ol.proj.fromLonLat([-61.530766,-34.865575]),
zoom: 7
})
});
}
這是繪製多邊形的功能,然後杜絕了它:
function addInteraction() {
var value = "polygon";
noDraw();
draw = new ol.interaction.Draw({
source: source,
type: "Polygon",
});
map.addInteraction(draw);
draw.on('drawend', function(evt){
var feature = evt.feature;
var p = feature.getGeometry();
var format = new ol.format.WKT();
poligonoWKT = format.writeGeometry(p.transform(ol.proj.get('EPSG:3857'),ol.proj.get('EPSG:4326')));
p.transform(ol.proj.get('EPSG:4326'),ol.proj.get('EPSG:3857'));
console.log(poligonoWKT);
noDraw();
$("#listgrouparea").show();
getArea();
});
}