[OpenLayers-Users] HTTP protocol with featureserver
Eric Lemoine
eric.c2c at gmail.com
Wed Dec 10 16:04:47 EST 2008
On Wed, Dec 10, 2008 at 9:59 PM, Alexandre Dube <adube at mapgears.com> wrote:
> Andreas Hocevar wrote:
>>
>> Yes, but quite some efforts would be required. Reading the insertIds
>> this is the format's job. Format.GeoJSON does not know about insertIds.
>> The best thing to do here would be to subclass Format.GeoJSON and create
>> e.g. a Format.GeoJSON.FeatureServer. The next thing is that you need a
>> protocol that can handle insertIds. Protocol.HTTP cannot do that, so
>> this would also have to be extended.
>>
>> I am also quite new to the vector behavior stuff, so I might be wrong.
>> But to me it seems that the above should work.
>>
>> Let me know when you need more help, because I have to gain deeper
>> insight into that code anyway and doing it for a purpose other than just
>> looking at it will also make it easier for me.
>>
>> Regards,
>> Andreas.
>>
>>
>
> Yep, that's exactly what I had in mind.
>
> Eric suggested to use the protocol.commit() function, but it has the same
> problem ( no fid on new added features ), so I'll have to implement one.
> I'm still trying to figure how to just add function on commit(), there's
> already something for that but I'm missing something because when I set one,
> it replaces what is usually does instead of adding one :
>
> olWFSRoads = new OpenLayers.Layer.Vector("Roads FS GeoJSON", {
> 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(),
> create: function(){alert("foo")} //<-- this gets triggered,
> but no POST is created...
> })
> });
>
> I'll continue to look deeper and try to understand this.
Alexandre, have you tried:
protocol.commit(features, {
"create": {
callback: function(response) {
console.log(response.features)
}
}
});
?
--
Eric
More information about the Users
mailing list