[OpenLayers-Users] Problem with save strategy

Mustafa646 noorcs22 at gmail.com
Mon Apr 11 11:08:54 EDT 2011


Below is my code which i am using for modifying features and drawing new
features.

saveStrategy = new OpenLayers.Strategy.Save();
               saveStrategy.events.register('success', null,
ChangesSuccess);
               saveStrategy.events.register('fail', null, ChangesFailed);

              wfs = new OpenLayers.Layer.Vector("Edit Vagmitt Polyline", {

                   styleMap: StyleMap,
                   eventListeners: {
                       "featuresadded": ZoomToData
                   },
                   strategies: [new OpenLayers.Strategy.Fixed(),
saveStrategy],
                   protocol: new OpenLayers.Protocol.WFS({
                       url: GEOSERVER_WFS,
                       featureType: "new_Vagmitt_polyline",
                       featureNS: "http://www.openplans.org/workspace",
                       geometryName: "the_geom",
                       srsName: "EPSG:900913",
                       version: "1.1.0",
                       extractAttributes: true,
                       isBaseLayer: false,
                       visibility: true
                   })

              });

new OpenLayers.Control.DrawFeature(wfs, OpenLayers.Handler.Path,
{displayClass: 'lineButton', title: 'Draw new line feature', handlerOptions:
{style: sty}});

new OpenLayers.Control.ModifyFeature(wfs, {title: 'Edit line feature'});

The code works fine for modifyFeature control, but its gives error on save
strategy when i draw a new feature.

The changes are also saved back to Geoserver when i modify the feature
(triggers ChangesSuccess). but in case of DrawFeature control, saveStrategy
triggers ChangesFailed function.

I could not understand, why ModifyFeature works but DrawFeature does't work.
Can anybody explain, where is the problem ?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problem-with-save-strategy-tp6261807p6261807.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list