-
Book Overview & Buying
-
Table Of Contents
OpenLayers 3.x Cookbook - Second Edition
By :
As we saw in the previous recipe, Drawing features across multiple vector layers, it's quite straightforward to enable drawing capabilities for the user. However, what if the user needs to edit drawn features? Perhaps they want to move some vertexes around or move the entire feature to a new place. We'll take a look at these types of modifications throughout this recipe.
OpenLayers provides the ol.interaction.Modify class to move or add vertexes and the ol.interaction.Translate class to move whole features about.
The source code can be found in ch05/ch05-modifying-features, and here's a screenshot of what this will look like when it's done:

Learn how to modify existing features by following these steps:
Create an HTML file with the OpenLayers dependencies and div to hold the map.
Create a custom JavaScript file and begin by instantiating map with view, a raster tile layer, and a vector layer that retrieves features from a local GeoJSON file:
var map = new ol.Map...
Change the font size
Change margin width
Change background colour