OpenLayers Draw Feature Example

point, line, linestring, polygon, box, digitizing, geometry, draw, drag

Demonstrate on-screen digitizing tools for point, line, polygon and box creation.

With the point drawing control active, click on the map to add a point.

With the line drawing control active, click on the map to add the points that make up your line. Double-click to finish drawing.

With the polygon drawing control active, click on the map to add the points that make up your polygon. Double-click to finish drawing.

With the box drawing control active, click in the map and drag the mouse to get a rectangle. Release the mouse to finish.

With any drawing control active, paning the map can still be achieved. Drag the map as usual for that.

Hold down the shift key while drawing to activate freehand mode. While drawing lines or polygons in freehand mode, hold the mouse down and a point will be added with every mouse movement.

Copied from openlayers-git\examples, and modified to local css and js

Sets up a WMS map layer, plus 4 vector layers - pointLayer "Point Layer", lineLayer "Line Layer", polygonLayer "Polygon Layer", and boxLayer "Box layer". Has 5 radio button, the first being just navigate. Selecting a radio button deactivates all other and establishes that type of drawing.

An interesting addition would be to allow 'feature' selection, and a 'hover' change, like in the highlight-feature.html example, at least for the polygon layer. Just cut in the code, and it sort of worked... Which leads to another interesting addition, and that would be the ability to delete a selected polygon.