Class: SketchOverlay

ol.layer. SketchOverlay

A sketch layer used as overlay to handle drawing sketch (helper for drawing tools)


new SketchOverlay(options)

Parameters:
Name Type Description
options *
Properties
Name Type Description
type string

Geometry type, default LineString

style ol.style.Style | Array.<ol.style.Style>

Drawing style

sketchStyle ol.style.Style | Array.<ol.style.Style>

Sketch style

Fires:
  • event:drawstart
  • event:drawend
  • event:drawabort

Extends

  • ol/layer/Vector

Methods


abortDrawing()

Abort drawing


addPoint(coord)

Add a new Point to the sketch

Parameters:
Name Type Description
coord ol.coordinate
Returns:

true if point has been added, false if same coord

Type
boolean

Draw/refresh link


drawSketch()

Draw/refresh sketch


finishDrawing()

Finish drawing

Returns:

the drawed feature

Type
ol.Feature

getFeature()

Get current feature


getGeometryType()

Get geometry type

Returns:

Geometry type

Type
string

getPosition()

Get current position

Returns:
Type
ol.coordinate

removeLastPoint()

Remove the last Point from the sketch


setGeometryType(type)

Set geometry type

Parameters:
Name Type Description
type string

Geometry type

Returns:

the current type

Type
string

setPosition(coord)

Set current position

Parameters:
Name Type Description
coord ol.coordinate

startDrawing(options, type, coordinates, feature, atstart)

Strat a new drawing

Parameters:
Name Type Description
options *
type string

Geometry type, default the current type

coordinates Array.<ol.coordinate>

a list of coordinates to extend

feature ol.Feature

a feature to extend (LineString or Polygon only)

atstart boolean

extent coordinates or feature at start, default false (extend at end)