0

Im trying to use the wfs-t in openayers using the savestrategy. I have created a savestrategy and it works when I for example uses the DrawFeature Control to add a point. A new point is added to the database. However, when I use the DragFeature control to move a point (in the same vector layer as I have added using DrawFeature) it doesnt work.

The response from Geoserver is

<wfs:InsertResult>
   <ogc:FeatureId fid="none"/>
</wfs:InsertResult>
<wfs:TransactionResult> 
  <wfs:Status> 
    <wfs:SUCCESS/> 
  </wfs:Status> 
</wfs:TransactionResult>

And to me that looks like for some reasons no information sent regarding the fid that should have been moved.

What could I havce done wrong? BR Mike

2 Answers 2

2

You need to set the feature's state to UPDATE. If you want to do it by hand, here is a code snipped:

wfs.events.register('afterfeaturemodified', null, afterModified);

function afterModified(e) {
  // only set to update if state is NOT INSERT and NOT DELTE !!!
  if(e.feature.state!=OpenLayers.State.INSERT &&
     e.feature.state!=OpenLayers.State.DELETE) {
       e.feature.state=OpenLayers.State.UPDATE;
  }
}

The ModifyFeature Control does set the flag automatically in the setFeatureState method. I suppose that the the DragFeature does not.

0

I changed to use the ModifyFeature Control instead of using the DragFeature COntrol and it worked like it should

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.