OpenLayers Editing Methods

# Editing Methods

Demonstrates the use of editing methods for manipulating geometries while drawing.

- insert x,y
- insert dx,dy
- insert direction/length
- insert deflection/length
- finish sketch
- cancel sketch

The `control.insertXY` method inserts a point at the given map coordinates (x, y) immediately prior to the most recent point (under the mouse). The `control.insertDeltaXY` method inserts a point at the given offset values (dx, dy) from the previously added point. The `control.insertDirectionLength` method inserts a point at offset direction and length from the previously added point. Direction is measured counter-clockwise from the positive x-axis. The `control.insertDeflectionLength` method inserts a point at offset deflection and length from the previously added point. Deflection is measured counter-clockwise from the previous line segment. The `control.finishSketch` method completes the current sketch without adding the point under the user's mouse. This allows a sketch to be finished without a double-click. The `control.cancel` method discards the current sketch and leaves the control active. The `control.insertXY` method may be called before any points are digitized manually. The other methods have no effect until at least one point has been added to the sketch.

View the editing-methods.js source to see how this is done.