I have generated the WPS request below using GeoServer's WPS Request Builder
. I wish to append more parameters to this request (geometry selection), and then send it either using GET or POST from within my OpenLayers JavaScript code. I can't seem to get information on how this can be done. How can I append geometry selection parameter to the request, and how can I send the request using OpenLayers? Any assistance will highly appreciated.
gs:Aggregate
features
aggregationAttribute
pop
function
Sum
singlePass
Yes
result
My environment: GeoServer 2.1.3, OpenLayers 2.11, PostGIS 1.5.
Answer
Incorporate filters within the
section in a
. The format of the filter is dependent on its type. More info on filters and examples is available here and here.
As for requests, I used OpenLayers' POST method to send request, as illustrated below:
var request = new OpenLayers.Request.POST({
url: WPS_HOST,
data: wpsRequestData,
headers: {
"Content-Type": "text/xml;charset=utf-8"
},
callback: function (response) {
//read the response from GeoServer
var gmlParser = new OpenLayers.Format.GML();
var xmlSum = gmlParser.read(response.responseText);
// TODO: More operations here
},
failure: function (response) {
alert("Something went wrong in the request");
}
});
I hope this will be of help to someone.
No comments:
Post a Comment