[OpenLayers-Users] WFS Get Feature using POST?
Phil Scadden
p.scadden at gns.cri.nz
Wed Nov 7 13:46:50 PST 2012
> I am trying to get the JSON response using the below code, the same
> origin policy is obviously being applied, however I am trying to do
> this without the use of a proxy.
Trying to do OL without a proxy is like beating yourself with a whip.
And do the explicit POST stuff is just making it harder than it needs to
me - OL provides all that function in nice wrappers - in this case
protocol. You are better off just taking a deep breath and doing the
proxy. The only exception would doing OL off a DVD (ie no server at all)
which is like beating yourself with a whip while banging your head on a
wall - I've been there, got the scars.
If you really insist then use protocol.script. ie
myProtocol = new OpenLayers.Protocol.Script({
url: "http://10.0.0.1:6001/geoserver/wfs?",
callbackKey: "format_options",
callbackPrefix: "callback:",
params: {
service: "WFS",
version: "1.1.0",
srsName:mySRS,
request: "GetFeature",
featurePrefix: yourPrefix,
typeName: yourType,
outputFormat: "json"
},
});
and then execute protocol.read to get the json. However, the read method
can take filters and getting these working in the script protocol is a
mission. I've sorted spatial filters and some comparison filters but
dont have a comprehensive solution.
Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
More information about the Users
mailing list