[GIS] Does OpenLayers3 support feature editing

openlayersweb-mapping

For OpenLayers2, there are nice examples which show how to create vector features and edit them (adding vertices, moving them, …), e.g. http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/modify-feature.html

Is it possible to reproduce this functionality in OpenLayers3? On the official website, I was only able to find an example which shows how to create vector features but not how to edit them: http://ol3js.org/en/master/examples/draw-features.html

Best Answer

The mechanism for modifying features in OpenLayers 3, similar to OpenLayers.Control.ModifyFeature in OpenLayers 2, has been added to the trunk and is called ol.interaction.Modify. Here is an example of modifying features only.

There is also a an example of combining draw and modify together, which uses an ol.FeatureOverlay, rather than ol.source.Vector, so that this can be passed to both the constructors for ol.interaction.Modify and ol.interaction.Draw, so that they can operate on the same vector objects and be simultaneously enabled. There is a method that looks for a shift press and single click to enable deleting a vertex.

Related Question