Class: Splitter

ol.interaction. Splitter

Interaction splitter: acts as a split feature agent while editing vector features (LineString).

new Splitter()

Name Type Description
options.source ol.source.Vector | Array.<ol.source.Vector>

The target source (or array of source) with features to be split (configured with useSpatialIndex set to true)

options.triggerSource ol.source.Vector

Any newly created or modified features from this source will be used to split features on the target source. If none is provided the target source is used instead.

options.features ol.Collection.<ol.Feature>

A collection of feature to be split (replace source target).

options.triggerFeatures ol.Collection.<ol.Feature>

Any newly created or modified features from this collection will be used to split features on the target source (replace triggerSource).

options.filter function | undefined

a filter that takes a feature and return true if the feature is eligible for splitting, default always split.

options.tolerance function | undefined

Distance between the calculated intersection and a vertex on the source geometry below which the existing vertex will be used for the split. Default is 1e-10.

To Do:
  • verify auto intersection on features that split.
  • beforesplit,event: aftersplit


  • ol.interaction.Interaction


intersectSegs(s1, s2)

Calculate intersection on 2 segs

Name Type Description
s1 Array.<_ol_coordinate_>

first seg to intersect (2 points)

s2 Array.<_ol_coordinate_>

second seg to intersect (2 points)


intersection point or false no intersection

boolean | _ol_coordinate_