1

Using openlayers (2.12) and drawing some vector features against a WFS-T interface (offered by geoserver).

Problem is, when I draw some geometries and pan a little bit too much, openlayers sends "wfs:GetFeature" message to WFS-T interface, and while doing this it resets all features I have drawn so far.

You can try this even using the public openlayers examples: http://openlayers.org/dev/examples/wfs-protocol-transactions.html

  1. draw some features
  2. pan / zoom around enough / too much before saving
  3. the features you drew disappear

Any way to prevent this?

1

Well, it seems there is no simple way to prevent this from happening. I ended up following advice on:

http://osgeo-org.1560.n6.nabble.com/Can-I-prevent-OpenLayers-from-losing-my-WFS-T-feature-edits-td5042133.html

What I do is that I configure a larger than normal ratio for the layer:

wfsLayerP = new OpenLayers.Layer.Vector(
        "layername",
        {
            strategies : [ new OpenLayers.Strategy.BBOX({ratio: 100})],

This is feasible since my layer does not contain much data when editing it. Changing ratio from 2 -> 100 almost completely removes GetFeature requests while panning / zooming reasonable amounts and solves the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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