[OpenLayers-Users] HTTP protocol with featureserver

Andreas Hocevar ahocevar at opengeo.org
Wed Dec 10 14:42:37 EST 2008


Hi Alexandre,

Alexandre Dube wrote:
> Hi list,
>
>   I use a sandbox version of OpenLayers ( topp/wfs ).  I'm trying 
> featureserver for the first time and having some difficulties with 
> transactions ( insert/update/delete ).
>
>   Here's how I define my layer :
>
>         var oSaveStrategy = new OpenLayers.Strategy.Save();
>         var szFSURL = szHost+"featureserver/featureserver.cgi";
>
>         olWFSRoads = new OpenLayers.Layer.Vector("Roads - FS", {
>             scales: oMap.getScales(8,10),
>             styleMap: oStyleMap,
>             strategies: [new OpenLayers.Strategy.BBOX(), oSaveStrategy],
>             protocol: new OpenLayers.Protocol.HTTP({
>                 url: szFSURL+"/bdga_route_l_arc?format=GeoJSON",
>                 format: new OpenLayers.Format.GeoJSON()
>             })
>         });
>
>     So far the layer displays its features correctly.  I can add and 
> save new features, but the fid of the added feature remains null unless 
> I refresh the page.
>   

I am not sure how the FeatureServer response after a commit looks like.
To investigate that further, you should set a breakpoint in
Protocol.Save::onCommit. response.reqFeatures should contain the
features you commited. response.insertIds should contain the fids
assigned by FeatureServer, in the same order.

>     I can see the "id" value that should be affected to the added 
> feature in the response of the request in Firebug.  And after a couple 
> of minutes browsing the code, it seems that there's nothing implemented 
> yet in Protocol.HTTP to read response its requests.  I've got a lot of 
> other issues ( update duplicates instead of modifying, can't delete yet 
> ) but I'll stick on this one for now, so my question is :
>
>     How can I read this response ?  Is there currently some work for 
> this ?  Or, did anybody use FeatureServer in OpenLayers and managed to 
> do some transactions ?  Or anybody willing to help me ?
>   

See above.

I hope this helps. Please report back your findings, since Tim and I
will be working on finishing the WFS work in the next couple of weeks.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list