Welcome !! DrawFeatures is an OpenLayers 3 plugin for drawing new features, edit or delete feature from map. See usage for demo. In progress: compatibility with NPM and Openlayers 4
git clone git@github.com:HamHamFonFon/ol3-drawFeatures.git ol3-drawFeatures
npm install --save ol3-draw-features
This exemples is showing how to use the plugin with Openlayers 3
Basic usage : you can add new features to the map, then editing or deleting them
Use Locale Storage : use localStorage to store features
Use with NPM : in progress...
new ol.control.ControlDrawButtons(vector_layer, opt_options)
Layer you will adding, edit or delete features
var vector_draw = new ol.layer.Vector({
source: new ol.source.Vector(),
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#ffcc33',
width: 2
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: '#ffcc33'
})
})
})
});
Option name | Type | Description |
---|---|---|
style_buttons | String | Use bootstrap glyphicon or default CSS. Values : `glyphicon |
local_storage | Boolean | (in progress) Possibility to record Layer in Local Storage |
draw | Array | Select buttons to show |
- Point | Boolean | Show point button |
- LineString | Boolean | Show line button |
- Square | Boolean | Show square button |
- Circle | Boolean | Show circle button |
- Polygon | Boolean | Show polygon button |
var optionsControlDraw = {
"style_buttons" : (undefined !== typeof style_buttons)? "glyphicon" : "default",
"local_storage": true,
"draw": {
"Point": true,
"LineString": true,
"Square": true,
"Circle": true,
"Polygon": true
}
};
var buttonsDrawControls = new ol.control.ControlDrawFeatures(myVectorLayer, optionsControlDraw);
In progress...
ol.control.Control
setSelectedLayer()
Set a layer who may be different tha the one in options array
buttonsDrawControls.setSelectedLayer(otherVectorLayer);
Stéphane MÉAUDRE stephane.meaudre@gmail.com smeaudre@kaliop.com
MIT Licence - 2016
My POC based on Kuzzle : Kurtography
README.md edited by StackEdit
Version | Tag | Published |
---|---|---|
1.0.3 | latest | 5yrs ago |