Skip to main content

Questions tagged [draw-interaction]

Filter by
Sorted by
Tagged with
8 votes
1 answer
10k views

Get feature from ol.interaction.Draw on drawend

My problem seems simple but I cannot find any questions that successfully solve it. I want to draw a circle using ol.interaction.Draw, and access the feature that is created immediately. My code as ...
Hank's user avatar
  • 325
4 votes
4 answers
16k views

Problem in remove interaction after draw end in openlayers-3

I'm using OpenLayers-3.8.2. I have a draw Ineraction as follow: function drawEnd(){ map.removeInteraction(drawIneraction). } var drawInteraction = new ol.interaction.Draw({ source: mysource, ...
Morteza Malvandi's user avatar
3 votes
1 answer
8k views

Openlayers drawing interaction geometryFunction

Can anyone help me to convert this function so that it is not dependant on the ol3-debug file as I don't know quite what is replaced upon build. The function works but only in debug mode. It is in ...
dvmac01's user avatar
  • 1,065
3 votes
0 answers
298 views

Drawing an Ellipse in Openlayers 4 with interaction

In OpenLayers 2, I could easily create a Control to draw an ellipse like this: new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.RegularPolygon, { handlerOptions:...
Lokomotywa's user avatar
  • 1,191
2 votes
1 answer
2k views

Creating points projected on line using QGIS?

How can we create points perpendicularly on a line with QGis ? Otherwise, how can we draw a line between one point and a line ? Here is a picture to show what we want :
Fred Audouit's user avatar
2 votes
1 answer
1k views

Openlayers 3 - Line with two points

I'm trying to create a tool which enables the user to draw a linestring with only 2 points. It's surprising how long I've searched and can't find an example or someone asking the question. I know ...
dvmac01's user avatar
  • 1,065
2 votes
1 answer
2k views

In OpenLayers how can I enable users to cancel the completion of a polygon, and carry on drawing it?

I am using the OpenLayers v4.6.5 Draw interaction. drawInteraction = new ol.interaction.Draw({...}); map.addInteraction(drawInteraction); I want users to be able to add properties to the features ...
Peter Cooper's user avatar
2 votes
2 answers
7k views

How to remove points on the Openlayers map?

I am experimenting with openlayers. I am adding points to the map using this example. However, I also want to delete unwanted points from the map. For example, I clicked 6 points on the map and I want ...
WOW's user avatar
  • 327
2 votes
0 answers
303 views

2D canvas library for OpenLayers. Drawing custom interactive objects

I am looking for the 2D canvas library like Konva.js that I can use above OpenLayers 5.x. I need to draw shapes with font inside that are interactive - can be dragged over the map to the appropriate ...
nickolay's user avatar
  • 121
1 vote
3 answers
3k views

openlayers interaction only on left mouse

Using openlayers (latest - 4), I have a drawing interaction that draws a circle - let drawCircle = new ol.interaction.Draw({source: source, type: "Circle"}); map.addInteraction(drawCircle); Both ...
user210757's user avatar
1 vote
1 answer
1k views

Setting map view extent dynamically in OpenLayers?

Referring to the examples posted here https://openlayers.org/en/latest/examples/draw-and-modify-features.html and https://openlayers.org/en/latest/examples/extent-interaction.html in the former ...
Amrmsmb's user avatar
  • 305
1 vote
1 answer
621 views

Selection with circle using JSTS

Anybody know if there is a possibility of using JSTS library with OL3, to create a circle for selecting marker in a map. Actually i succeed creating a polygon which can select markers and return the ...
Inès Zarka's user avatar
1 vote
1 answer
103 views

Snap interaction not working before first point drawn in OpenLayers

I'm trying to add snap interaction to map using OpenLayers. Snap works on draw but only after drawing first point of polygon. Is there a way to make it snap while starting to draw the polygon? I tried ...
Smita Verma's user avatar
1 vote
0 answers
2k views

OpenLayers: draw a shape (square or circle) where the user clicks on map [closed]

In OpenLayers 6, using OSM, I'm trying to draw either a square or a circle where the user clicks on a map. The shape should be (around) 5km of side or radius. So far I've produced the following to ...
Jack's user avatar
  • 111
1 vote
0 answers
199 views

Concatenating coordinates inside geometryFunction

While looking at this example, I came upon the following code (taken verbatim by using 'view page source'): interaction: new ol.interaction.Draw({ type: 'Polygon', source: vector.getSource(...
Marcus Junius Brutus's user avatar
0 votes
1 answer
1k views

finishCondition based on feature being drawn

I have a draw interaction in Openlayers 4. I'm using it to draw polygons. I would like to continue drawing the polygon if its area is less than a default value. I tried using the property ...
Jose Hermosilla Rodrigo's user avatar
0 votes
1 answer
2k views

Openlayers VectorTiles Draw Interaction

I am trying to add a the draw interaction to my openlayers 4.1.0 VectorTile layer. I have been able to add the draw interaction to a Vector layer, but not a VectorTile layer. Below is my js code: ...
user908759's user avatar
0 votes
0 answers
230 views

Disable freehand drawing in draw interaction in OpenLayers?

I have this: draw = new ol.interaction.Draw({ source: drawVector.getSource(), type: "LineString", freehand: false, finishCondition: function(event) { ...
Alejandro's user avatar
0 votes
1 answer
291 views

Delete feature draw selected does not update map

I have code to draw lines, polygons, point and circle in Openlayers. I can select a design and delete it. When I run this code to delete, it deletes the drawing from the map, unless the drawing was ...
user12538529's user avatar
0 votes
0 answers
590 views

Converting feature from draw interaction to WKT string

I've problems with converting the feature which I'm getting in draw interaction into the WKT string. I saw multiple examples which looks like it should be simple but I'm always getting the following ...
Dawid Rutkowski's user avatar