[OpenLayers-Users] HTTP protocol with featureserver

Eric Lemoine eric.c2c at gmail.com
Wed Dec 10 14:53:22 EST 2008


On Wed, Dec 10, 2008 at 8:42 PM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> 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.

It seems to be that response.insertIds, and thus Strategy.Save, is
Protocol.WFS-specific, isn't it?

If I'm correct Alexandre should not rely on the save strategy at this
point, and use protocol.commit directly instead.

--
Eric



More information about the Users mailing list