9
votes
Accepted
Get feature from ol.interaction.Draw on drawend
Best solution I've found so far is to use the current feature embedded in the event:
var radiusSelectInteraction = new ol.interaction.Draw({
source: circleLayer.getSource(),
type: 'Circle',
...
7
votes
Creating points projected on line using QGIS?
If you only need to show these lines/points, you can do this with a geometry generator marker style. This is a fairly new feature in QGIS, and it makes it easy to do things that would have needed a ...
4
votes
Accepted
In OpenLayers how can I enable users to cancel the completion of a polygon, and carry on drawing it?
finishCondition: function(event) { return confirm("Are you sure?"); } works for me.
4
votes
Accepted
openlayers interaction only on left mouse
You can use condition option for ol.interaction.Draw.
when condition meets, drawing will be started.
In your case, drawing should be start with leftclick(which means button code 1)
So, simply add ...
4
votes
Problem in remove interaction after draw end in openlayers-3
The proper way to handle this is something like:
// Find the double click interaction that is on the map.
var dblclickzoom;
map.getInteractions().forEach(function (interaction) {
if (interaction ...
3
votes
Problem in remove interaction after draw end in openlayers-3
Try the stopClick option
var drawInteraction = new ol.interaction.Draw({
source: mysource,
type: 'LineString',
stopClick: true
});
2
votes
Accepted
Setting map view extent dynamically in OpenLayers?
Since view object has no .setExtent() method, one possible solution would be to create new view with the desired extent and set map view to that view.
Code for function that sets map view extent ...
1
vote
Accepted
finishCondition based on feature being drawn
Not sure if this is the best solution:
I created a variable whichs points to the feature being drawn:
new ol.interaction.Draw({
...,
stopClick: true,
finishCondition: (event) => ...
1
vote
Openlayers VectorTiles Draw Interaction
Check the documentation: Although this source receives tiles with vector features from the server, it is not meant for feature editing.
So, you can not add a ol.interaction.Draw interaction to add ...
1
vote
How to remove points on the Openlayers map?
We can create a new variable as sourceVector.
var sourceVector = new ol.source.Vector({features: features})
Then on this line source: new ol.source.Vector({features: features}),
change it to
...
1
vote
How to remove points on the Openlayers map?
The third example you linked to covers this pretty nicely I think.
You need to add another interaction - a select interaction - to allow selection of a feature when it's clicked. Something like the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
draw-interaction × 20openlayers × 19
javascript × 3
geometry × 3
map-drawing × 3
vector-layer × 2
qgis × 1
vector × 1
features × 1
extents × 1
well-known-text × 1
snapping × 1
points-to-line × 1
mapcanvas × 1
context-menu × 1
drawing × 1
modify-interaction × 1
ol-interaction × 1