I would like to make a selection with DragBox interaction and get the geometry type to Multipolygon.
Right now I'm getting a Polygon type back :
var source = new ol.source.Vector({wrapX: false});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Vector({
source: source
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-3, 48]),
zoom: 7
}),
});
var select = new ol.interaction.Select();
var dragBox = new ol.interaction.DragBox({
condition: ol.events.condition.platformModifierKeyOnly });
dragBox.on('boxend', function() {
var geom = dragBox.getGeometry();
var format = new ol.format.WKT();
var wktRepresentation = format.writeGeometry(geom);
console.log("wktRepresentation: " + wktRepresentation);
});
Can someone help me?