Skip to main content
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', ...
Hank's user avatar
  • 325
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 ...
Steven Kay's user avatar
  • 20.6k
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.
Mike's user avatar
  • 12.9k
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 ...
Chase Choi's user avatar
  • 1,087
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 ...
chander's user avatar
  • 151
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 });
Argiropoulos Stavros's user avatar
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 ...
TomazicM's user avatar
  • 27k
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) => ...
Jose Hermosilla Rodrigo's user avatar
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 ...
jgrocha's user avatar
  • 5,515
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 ...
codejays's user avatar
  • 111
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 ...
rbkb's user avatar
  • 656

Only top scored, non community-wiki answers of a minimum length are eligible