Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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