I enabled the functionality to draw Polygons, as in the example. http://dev.openlayers.org/examples/draw-feature.html
Now I want that, once I created a polygon, this polygon is saved as a feature from an underlying WFS layer.
How can I do this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI enabled the functionality to draw Polygons, as in the example. http://dev.openlayers.org/examples/draw-feature.html
Now I want that, once I created a polygon, this polygon is saved as a feature from an underlying WFS layer.
How can I do this?
You need to use WFS-T, the T standing for transactional, which is what's required to be able to write-back. Both Openlayers and GeoServer support this.
This question may help on the script side - WFS-T: changes not saved on an OpenLayers map
There's also a sample tutorial here: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html