add formats for WPS GetCapabilities, WPS DescribeProcess and WPS Execute, thanks ahocevar for the great rework on the patch, r=ahocevar, see #3307)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12124 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -333,6 +333,10 @@
|
||||
"OpenLayers/Format/OWSContext/v0_3_1.js",
|
||||
"OpenLayers/Format/WMTSCapabilities.js",
|
||||
"OpenLayers/Format/WMTSCapabilities/v1_0_0.js",
|
||||
"OpenLayers/Format/WPSCapabilities.js",
|
||||
"OpenLayers/Format/WPSCapabilities/v1_0_0.js",
|
||||
"OpenLayers/Format/WPSDescribeProcess.js",
|
||||
"OpenLayers/Format/WPSExecute.js",
|
||||
"OpenLayers/Format/XLS.js",
|
||||
"OpenLayers/Format/XLS/v1.js",
|
||||
"OpenLayers/Format/XLS/v1_1_0.js",
|
||||
|
||||
@@ -232,6 +232,9 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
delete obj.bottom;
|
||||
delete obj.right;
|
||||
delete obj.top;
|
||||
},
|
||||
"Language": function(node, obj) {
|
||||
obj.language = this.getChildValue(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -264,11 +267,21 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
value: options.bounds.right + " " + options.bounds.top });
|
||||
return node;
|
||||
},
|
||||
"Identifier": function(identifier) {
|
||||
var node = this.createElementNSPlus("ows:Identifier", {
|
||||
value: identifier });
|
||||
return node;
|
||||
},
|
||||
"Title": function(title) {
|
||||
var node = this.createElementNSPlus("ows:Title", {
|
||||
value: title });
|
||||
return node;
|
||||
},
|
||||
"Abstract": function(abstractValue) {
|
||||
var node = this.createElementNSPlus("ows:Abstract", {
|
||||
value: abstractValue });
|
||||
return node;
|
||||
},
|
||||
"OutputFormat": function(format) {
|
||||
var node = this.createElementNSPlus("ows:OutputFormat", {
|
||||
value: format });
|
||||
|
||||
@@ -47,6 +47,9 @@ OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
"AnyValue": function(node, parameter) {
|
||||
parameter.anyValue = true;
|
||||
},
|
||||
"DataType": function(node, parameter) {
|
||||
parameter.dataType = this.getChildValue(node);
|
||||
},
|
||||
"Range": function(node, allowedValues) {
|
||||
allowedValues.range = {};
|
||||
this.readChildNodes(node, allowedValues.range);
|
||||
@@ -65,7 +68,46 @@ OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
}
|
||||
}, OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"])
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Property: writers
|
||||
* As a compliment to the readers property, this structure contains public
|
||||
* writing functions grouped by namespace alias and named like the
|
||||
* node names they produce.
|
||||
*/
|
||||
writers: {
|
||||
"ows": OpenLayers.Util.applyDefaults({
|
||||
"Range": function(range) {
|
||||
var node = this.createElementNSPlus("ows:Range", {
|
||||
attributes: {
|
||||
'ows:rangeClosure': range.closure
|
||||
}
|
||||
});
|
||||
this.writeNode("ows:MinimumValue", range.minValue, node);
|
||||
this.writeNode("ows:MaximumValue", range.maxValue, node);
|
||||
return node;
|
||||
},
|
||||
"MinimumValue": function(minValue) {
|
||||
var node = this.createElementNSPlus("ows:MinimumValue", {
|
||||
value: minValue
|
||||
});
|
||||
return node;
|
||||
},
|
||||
"MaximumValue": function(maxValue) {
|
||||
var node = this.createElementNSPlus("ows:MaximumValue", {
|
||||
value: maxValue
|
||||
});
|
||||
return node;
|
||||
},
|
||||
"Value": function(value) {
|
||||
var node = this.createElementNSPlus("ows:Value", {
|
||||
value: value
|
||||
});
|
||||
return node;
|
||||
}
|
||||
}, OpenLayers.Format.OWSCommon.v1.prototype.writers["ows"])
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.OWSCommon.v1_1_0"
|
||||
|
||||
});
|
||||
|
||||
79
lib/OpenLayers/Format/WPSCapabilities.js
Normal file
79
lib/OpenLayers/Format/WPSCapabilities.js
Normal file
@@ -0,0 +1,79 @@
|
||||
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the Clear BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
||||
* full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/XML.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WPSCapabilities
|
||||
* Read WPS Capabilities.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.XML>
|
||||
*/
|
||||
OpenLayers.Format.WPSCapabilities = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
|
||||
/**
|
||||
* APIProperty: defaultVersion
|
||||
* {String} Version number to assume if none found. Default is "1.0.0".
|
||||
*/
|
||||
defaultVersion: "1.0.0",
|
||||
|
||||
/**
|
||||
* APIProperty: version
|
||||
* {String} Specify a version string if one is known.
|
||||
*/
|
||||
version: null,
|
||||
|
||||
/**
|
||||
* Property: parser
|
||||
* {<OpenLayers.Format>} A cached versioned format used for reading.
|
||||
*/
|
||||
parser: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WPSCapabilities
|
||||
* Create a new parser for WPS Capabilities.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
|
||||
/**
|
||||
* APIMethod: read
|
||||
* Read capabilities data from a string, and return information about
|
||||
* the service.
|
||||
*
|
||||
* Parameters:
|
||||
* data - {String} or {DOMElement} data to read/parse.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} Info about the WPS
|
||||
*/
|
||||
read: function(data) {
|
||||
if(typeof data == "string") {
|
||||
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
|
||||
}
|
||||
var root = data.documentElement;
|
||||
var version = this.version || root.getAttribute("version") || this.defaultVersion;
|
||||
if(!this.parser || this.parser.version !== version) {
|
||||
var constr = OpenLayers.Format.WPSCapabilities[
|
||||
"v" + version.replace(/\./g, "_")
|
||||
];
|
||||
if(!constr) {
|
||||
throw "Can't find a WPS capabilities parser for version " + version;
|
||||
}
|
||||
var parser = new constr(this.options);
|
||||
}
|
||||
var capabilities = parser.read(data);
|
||||
capabilities.version = version;
|
||||
return capabilities;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WPSCapabilities"
|
||||
|
||||
});
|
||||
119
lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js
Normal file
119
lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js
Normal file
@@ -0,0 +1,119 @@
|
||||
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the Clear BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
||||
* full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/WPSCapabilities.js
|
||||
* @requires OpenLayers/Format/OWSCommon/v1_1_0.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WPSCapabilities.v1_0_0
|
||||
* Read WPS Capabilities version 1.0.0.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.XML>
|
||||
*/
|
||||
OpenLayers.Format.WPSCapabilities.v1_0_0 = OpenLayers.Class(
|
||||
OpenLayers.Format.XML, {
|
||||
|
||||
/**
|
||||
* Property: namespaces
|
||||
* {Object} Mapping of namespace aliases to namespace URIs.
|
||||
*/
|
||||
namespaces: {
|
||||
ows: "http://www.opengis.net/ows/1.1",
|
||||
wps: "http://www.opengis.net/wps/1.0.0",
|
||||
xlink: "http://www.w3.org/1999/xlink"
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: regExes
|
||||
* Compiled regular expressions for manipulating strings.
|
||||
*/
|
||||
regExes: {
|
||||
trimSpace: (/^\s*|\s*$/g),
|
||||
removeSpace: (/\s*/g),
|
||||
splitSpace: (/\s+/),
|
||||
trimComma: (/\s*,\s*/g)
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WPSCapabilities.v1_0_0
|
||||
* Create a new parser for WPS capabilities version 1.0.0.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: read
|
||||
* Read capabilities data from a string, and return info about the WPS.
|
||||
*
|
||||
* Parameters:
|
||||
* data - {String} or {DOMElement} data to read/parse.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} Information about the WPS service.
|
||||
*/
|
||||
read: function(data) {
|
||||
if(typeof data == "string") {
|
||||
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
|
||||
}
|
||||
if(data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var capabilities = {};
|
||||
this.readNode(data, capabilities);
|
||||
return capabilities;
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: readers
|
||||
* Contains public functions, grouped by namespace prefix, that will
|
||||
* be applied when a namespaced node is found matching the function
|
||||
* name. The function will be applied in the scope of this parser
|
||||
* with two arguments: the node being read and a context object passed
|
||||
* from the parent.
|
||||
*/
|
||||
readers: {
|
||||
"wps": {
|
||||
"Capabilities": function(node, obj) {
|
||||
this.readChildNodes(node, obj);
|
||||
},
|
||||
"ProcessOfferings": function(node, obj) {
|
||||
obj.processOfferings = {};
|
||||
this.readChildNodes(node, obj.processOfferings);
|
||||
},
|
||||
"Process": function(node, processOfferings) {
|
||||
var processVersion = this.getAttributeNS(node, this.namespaces.wps, "processVersion");
|
||||
var process = {processVersion: processVersion};
|
||||
this.readChildNodes(node, process);
|
||||
processOfferings[process.identifier] = process;
|
||||
},
|
||||
"Languages": function(node, obj) {
|
||||
obj.languages = [];
|
||||
this.readChildNodes(node, obj.languages);
|
||||
},
|
||||
"Default": function(node, languages) {
|
||||
var language = {isDefault: true};
|
||||
this.readChildNodes(node, language);
|
||||
languages.push(language);
|
||||
},
|
||||
"Supported": function(node, languages) {
|
||||
var language = {};
|
||||
this.readChildNodes(node, language);
|
||||
languages.push(language);
|
||||
}
|
||||
},
|
||||
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WPSCapabilities.v1_0_0"
|
||||
|
||||
});
|
||||
180
lib/OpenLayers/Format/WPSDescribeProcess.js
Normal file
180
lib/OpenLayers/Format/WPSDescribeProcess.js
Normal file
@@ -0,0 +1,180 @@
|
||||
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the Clear BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
||||
* full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/XML.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WPSDescribeProcess
|
||||
* Read WPS DescribeProcess responses.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.XML>
|
||||
*/
|
||||
OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(
|
||||
OpenLayers.Format.XML, {
|
||||
|
||||
/**
|
||||
* Constant: VERSION
|
||||
* {String} 1.0.0
|
||||
*/
|
||||
VERSION: "1.0.0",
|
||||
|
||||
/**
|
||||
* Property: namespaces
|
||||
* {Object} Mapping of namespace aliases to namespace URIs.
|
||||
*/
|
||||
namespaces: {
|
||||
wps: "http://www.opengis.net/wps/1.0.0",
|
||||
ows: "http://www.opengis.net/ows/1.1",
|
||||
xsi: "http://www.w3.org/2001/XMLSchema-instance"
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: schemaLocation
|
||||
* {String} Schema location
|
||||
*/
|
||||
schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
|
||||
|
||||
/**
|
||||
* Property: defaultPrefix
|
||||
*/
|
||||
defaultPrefix: "wps",
|
||||
|
||||
/**
|
||||
* Property: regExes
|
||||
* Compiled regular expressions for manipulating strings.
|
||||
*/
|
||||
regExes: {
|
||||
trimSpace: (/^\s*|\s*$/g),
|
||||
removeSpace: (/\s*/g),
|
||||
splitSpace: (/\s+/),
|
||||
trimComma: (/\s*,\s*/g)
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WPSDescribeProcess
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
|
||||
/**
|
||||
* APIMethod: read
|
||||
* Parse a WPS DescribeProcess and return an object with its information.
|
||||
*
|
||||
* Parameters:
|
||||
* data - {String} or {DOMElement} data to read/parse.
|
||||
*
|
||||
* Returns:
|
||||
* {Object}
|
||||
*/
|
||||
read: function(data) {
|
||||
if(typeof data == "string") {
|
||||
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
|
||||
}
|
||||
if(data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var info = {};
|
||||
this.readNode(data, info);
|
||||
return info;
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: readers
|
||||
* Contains public functions, grouped by namespace prefix, that will
|
||||
* be applied when a namespaced node is found matching the function
|
||||
* name. The function will be applied in the scope of this parser
|
||||
* with two arguments: the node being read and a context object passed
|
||||
* from the parent.
|
||||
*/
|
||||
readers: {
|
||||
"wps": {
|
||||
"ProcessDescriptions": function(node, obj) {
|
||||
obj.processDescriptions = {};
|
||||
this.readChildNodes(node, obj.processDescriptions);
|
||||
},
|
||||
"ProcessDescription": function(node, processDescriptions) {
|
||||
var processVersion = this.getAttributeNS(node, this.namespaces.wps, "processVersion");
|
||||
var processDescription = {
|
||||
processVersion: processVersion,
|
||||
statusSupported: (node.getAttribute("statusSupported") === "true"),
|
||||
storeSupported: (node.getAttribute("storeSupported") === "true")
|
||||
};
|
||||
this.readChildNodes(node, processDescription);
|
||||
processDescriptions[processDescription.identifier] = processDescription;
|
||||
},
|
||||
"DataInputs": function(node, processDescription) {
|
||||
processDescription.dataInputs = [];
|
||||
this.readChildNodes(node, processDescription.dataInputs);
|
||||
},
|
||||
"ProcessOutputs": function(node, processDescription) {
|
||||
processDescription.processOutputs = [];
|
||||
this.readChildNodes(node, processDescription.processOutputs);
|
||||
},
|
||||
"Output": function(node, processOutputs) {
|
||||
var output = {};
|
||||
this.readChildNodes(node, output);
|
||||
processOutputs.push(output);
|
||||
},
|
||||
"ComplexOutput": function(node, output) {
|
||||
output.complexOutput = {};
|
||||
this.readChildNodes(node, output.complexOutput);
|
||||
},
|
||||
"Input": function(node, dataInputs) {
|
||||
var input = {
|
||||
maxOccurs: parseInt(node.getAttribute("maxOccurs")),
|
||||
minOccurs: parseInt(node.getAttribute("minOccurs"))
|
||||
};
|
||||
this.readChildNodes(node, input);
|
||||
dataInputs.push(input);
|
||||
},
|
||||
"BoundingBoxData": function(node, input) {
|
||||
input.boundingBoxData = {};
|
||||
this.readChildNodes(node, input.boundingBoxData);
|
||||
},
|
||||
"CRS": function(node, obj) {
|
||||
if (!obj.CRSs) {
|
||||
obj.CRSs = {};
|
||||
}
|
||||
obj.CRSs[this.getChildValue(node)] = true;
|
||||
},
|
||||
"LiteralData": function(node, input) {
|
||||
input.literalData = {};
|
||||
this.readChildNodes(node, input.literalData);
|
||||
},
|
||||
"ComplexData": function(node, input) {
|
||||
input.complexData = {};
|
||||
this.readChildNodes(node, input.complexData);
|
||||
},
|
||||
"Default": function(node, complexData) {
|
||||
complexData["default"] = {};
|
||||
this.readChildNodes(node, complexData["default"]);
|
||||
},
|
||||
"Supported": function(node, complexData) {
|
||||
complexData["supported"] = {};
|
||||
this.readChildNodes(node, complexData["supported"]);
|
||||
},
|
||||
"Format": function(node, obj) {
|
||||
var format = {};
|
||||
this.readChildNodes(node, format);
|
||||
if (!obj.formats) {
|
||||
obj.formats = {};
|
||||
}
|
||||
obj.formats[format.mimeType] = true;
|
||||
},
|
||||
"MimeType": function(node, format) {
|
||||
format.mimeType = this.getChildValue(node);
|
||||
}
|
||||
},
|
||||
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WPSDescribeProcess"
|
||||
|
||||
});
|
||||
243
lib/OpenLayers/Format/WPSExecute.js
Normal file
243
lib/OpenLayers/Format/WPSExecute.js
Normal file
@@ -0,0 +1,243 @@
|
||||
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the Clear BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
||||
* full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/XML.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WPSExecute version 1.0.0
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.XML>
|
||||
*/
|
||||
OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
|
||||
/**
|
||||
* Property: namespaces
|
||||
* {Object} Mapping of namespace aliases to namespace URIs.
|
||||
*/
|
||||
namespaces: {
|
||||
ows: "http://www.opengis.net/ows/1.1",
|
||||
gml: "http://www.opengis.net/gml",
|
||||
wps: "http://www.opengis.net/wps/1.0.0",
|
||||
wfs: "http://www.opengis.net/wfs",
|
||||
ogc: "http://www.opengis.net/ogc",
|
||||
wcs: "http://www.opengis.net/wcs/1.1.1",
|
||||
xlink: "http://www.w3.org/1999/xlink",
|
||||
xsi: "http://www.w3.org/2001/XMLSchema-instance"
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: regExes
|
||||
* Compiled regular expressions for manipulating strings.
|
||||
*/
|
||||
regExes: {
|
||||
trimSpace: (/^\s*|\s*$/g),
|
||||
removeSpace: (/\s*/g),
|
||||
splitSpace: (/\s+/),
|
||||
trimComma: (/\s*,\s*/g)
|
||||
},
|
||||
|
||||
/**
|
||||
* Constant: VERSION
|
||||
* {String} 1.0.0
|
||||
*/
|
||||
VERSION: "1.0.0",
|
||||
|
||||
/**
|
||||
* Property: schemaLocation
|
||||
* {String} Schema location
|
||||
*/
|
||||
schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
|
||||
|
||||
schemaLocationAttr: function(options) {
|
||||
return undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WPSExecute
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Method: write
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} Optional object.
|
||||
*
|
||||
* Returns:
|
||||
* {String} An WPS Execute request XML string.
|
||||
*/
|
||||
write: function(options) {
|
||||
var doc;
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject("Microsoft.XMLDOM");
|
||||
this.xmldom = doc;
|
||||
} else {
|
||||
doc = document.implementation.createDocument("", "", null);
|
||||
}
|
||||
var node = this.writeNode("wps:Execute", options, doc);
|
||||
this.setAttributeNS(
|
||||
node, this.namespaces.xsi,
|
||||
"xsi:schemaLocation", this.schemaLocation
|
||||
);
|
||||
return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: writers
|
||||
* As a compliment to the readers property, this structure contains public
|
||||
* writing functions grouped by namespace alias and named like the
|
||||
* node names they produce.
|
||||
*/
|
||||
writers: {
|
||||
"wps": {
|
||||
"Execute": function(options) {
|
||||
var node = this.createElementNSPlus("wps:Execute", {
|
||||
attributes: {
|
||||
version: this.VERSION,
|
||||
service: 'WPS'
|
||||
}
|
||||
});
|
||||
this.writeNode("ows:Identifier", options.identifier, node);
|
||||
this.writeNode("wps:DataInputs", options.dataInputs, node);
|
||||
this.writeNode("wps:ResponseForm", options.responseForm, node);
|
||||
return node;
|
||||
},
|
||||
"ResponseForm": function(responseForm) {
|
||||
var node = this.createElementNSPlus("wps:ResponseForm", {});
|
||||
if (responseForm.rawDataOutput) {
|
||||
this.writeNode("wps:RawDataOutput", responseForm.rawDataOutput, node);
|
||||
}
|
||||
if (responseForm.responseDocument) {
|
||||
this.writeNode("wps:ResponseDocument", responseForm.responseDocument, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"ResponseDocument": function(responseDocument) {
|
||||
var node = this.createElementNSPlus("wps:ResponseDocument", {
|
||||
attributes: {
|
||||
storeExecuteResponse: responseDocument.storeExecuteResponse,
|
||||
lineage: responseDocument.lineage,
|
||||
status: responseDocument.status
|
||||
}
|
||||
});
|
||||
if (responseDocument.output) {
|
||||
this.writeNode("wps:Output", responseDocument.output, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"Output": function(output) {
|
||||
var node = this.createElementNSPlus("wps:Output", {
|
||||
attributes: {
|
||||
asReference: output.asReference
|
||||
}
|
||||
});
|
||||
this.writeNode("ows:Identifier", output.identifier, node);
|
||||
this.writeNode("ows:Title", output.title, node);
|
||||
this.writeNode("ows:Abstract", output["abstract"], node);
|
||||
return node;
|
||||
},
|
||||
"RawDataOutput": function(rawDataOutput) {
|
||||
var node = this.createElementNSPlus("wps:RawDataOutput", {
|
||||
attributes: {
|
||||
mimeType: rawDataOutput.mimeType
|
||||
}
|
||||
});
|
||||
this.writeNode("ows:Identifier", rawDataOutput.identifier, node);
|
||||
return node;
|
||||
},
|
||||
"DataInputs": function(dataInputs) {
|
||||
var node = this.createElementNSPlus("wps:DataInputs", {});
|
||||
for (var i=0, ii=dataInputs.length; i<ii; ++i) {
|
||||
this.writeNode("wps:Input", dataInputs[i], node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"Input": function(input) {
|
||||
var node = this.createElementNSPlus("wps:Input", {});
|
||||
this.writeNode("ows:Identifier", input.identifier, node);
|
||||
if (input.title) {
|
||||
this.writeNode("ows:Title", input.title, node);
|
||||
}
|
||||
if (input.data) {
|
||||
this.writeNode("wps:Data", input.data, node);
|
||||
}
|
||||
if (input.reference) {
|
||||
this.writeNode("wps:Reference", input.reference, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"Data": function(data) {
|
||||
var node = this.createElementNSPlus("wps:Data", {});
|
||||
if (data.literalData) {
|
||||
this.writeNode("wps:LiteralData", data.literalData, node);
|
||||
} else if (data.complexData) {
|
||||
this.writeNode("wps:ComplexData", data.complexData, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"LiteralData": function(literalData) {
|
||||
var node = this.createElementNSPlus("wps:LiteralData", {
|
||||
attributes: {
|
||||
uom: literalData.uom
|
||||
},
|
||||
value: literalData.value
|
||||
});
|
||||
return node;
|
||||
},
|
||||
"ComplexData": function(complexData) {
|
||||
var node = this.createElementNSPlus("wps:ComplexData", {
|
||||
attributes: {
|
||||
mimeType: complexData.mimeType,
|
||||
encoding: complexData.encoding,
|
||||
schema: complexData.schema
|
||||
}
|
||||
});
|
||||
node.appendChild(
|
||||
this.getXMLDoc().createCDATASection(complexData.value)
|
||||
);
|
||||
return node;
|
||||
},
|
||||
"Reference": function(reference) {
|
||||
var node = this.createElementNSPlus("wps:Reference", {
|
||||
attributes: {
|
||||
mimeType: reference.mimeType,
|
||||
"xlink:href": reference.href,
|
||||
method: reference.method,
|
||||
encoding: reference.encoding,
|
||||
schema: reference.schema
|
||||
}
|
||||
});
|
||||
if (reference.body) {
|
||||
this.writeNode("wps:Body", reference.body, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
"Body": function(body) {
|
||||
var node = this.createElementNSPlus("wps:Body", {});
|
||||
if (body.wfs) {
|
||||
// OpenLayers.Format.WFST expects these to be on the
|
||||
// instance and not in the options
|
||||
this.featureType = body.wfs.featureType;
|
||||
this.version = body.wfs.version;
|
||||
this.writeNode("wfs:GetFeature", body.wfs, node);
|
||||
} else {
|
||||
this.writeNode("wps:Execute", body, node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
},
|
||||
"wfs": OpenLayers.Format.WFST.v1_1_0.prototype.writers.wfs,
|
||||
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WPSExecute"
|
||||
|
||||
});
|
||||
30
tests/Format/WPSCapabilities/v1_0_0.html
Normal file
30
tests/Format/WPSCapabilities/v1_0_0.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../OLLoader.js"></script>
|
||||
<script src="v1_0_0.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_read(t) {
|
||||
|
||||
t.plan(7);
|
||||
|
||||
var format = new OpenLayers.Format.WPSCapabilities();
|
||||
var obj = format.read(doc);
|
||||
|
||||
t.eq(obj.version, "1.0.0", "Version parsed correctly");
|
||||
|
||||
t.eq(obj.languages.length, 2, "2 language entries parsed");
|
||||
t.eq(obj.languages[0].isDefault, true, "First language is the default language");
|
||||
t.eq(obj.languages[0].language, "en-US", "First language is US English");
|
||||
|
||||
var buffer = obj.processOfferings["JTS:buffer"];
|
||||
t.eq(buffer.processVersion, "1.0.0", "processVersion for buffer is 1.0.0");
|
||||
t.eq(buffer.abstract, "Buffers a geometry using a certain distance", "Buffer abstract correctly read");
|
||||
t.eq(buffer.title, "Buffers a geometry using a certain distance", "Buffer title correctly read");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
112
tests/Format/WPSCapabilities/v1_0_0.js
Normal file
112
tests/Format/WPSCapabilities/v1_0_0.js
Normal file
@@ -0,0 +1,112 @@
|
||||
var doc = new OpenLayers.Format.XML().read(
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<wps:Capabilities xml:lang="en" service="WPS" version="1.0.0"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"' +
|
||||
' xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
||||
' <ows:ServiceIdentification>' +
|
||||
' <ows:Title>Prototype GeoServer WPS</ows:Title>' +
|
||||
' <ows:Abstract/>' +
|
||||
' <ows:ServiceType>WPS</ows:ServiceType>' +
|
||||
' <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>' +
|
||||
' </ows:ServiceIdentification>' +
|
||||
' <ows:ServiceProvider>' +
|
||||
' <ows:ProviderName>The ancient geographes INC</ows:ProviderName>' +
|
||||
' <ows:ProviderSite xlink:href="http://geoserver.org"/>' +
|
||||
' <ows:ServiceContact/>' +
|
||||
' </ows:ServiceProvider>' +
|
||||
' <ows:OperationsMetadata>' +
|
||||
' <ows:Operation name="GetCapabilities">' +
|
||||
' <ows:DCP>' +
|
||||
' <ows:HTTP>' +
|
||||
' <ows:Get xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' <ows:Post xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' </ows:HTTP>' +
|
||||
' </ows:DCP>' +
|
||||
' </ows:Operation>' +
|
||||
' <ows:Operation name="DescribeProcess">' +
|
||||
' <ows:DCP>' +
|
||||
' <ows:HTTP>' +
|
||||
' <ows:Get xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' <ows:Post xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' </ows:HTTP>' +
|
||||
' </ows:DCP>' +
|
||||
' </ows:Operation>' +
|
||||
' <ows:Operation name="Execute">' +
|
||||
' <ows:DCP>' +
|
||||
' <ows:HTTP>' +
|
||||
' <ows:Get xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' <ows:Post xlink:href="http://localhost:8080/geoserver/wps"/>' +
|
||||
' </ows:HTTP>' +
|
||||
' </ows:DCP>' +
|
||||
' </ows:Operation>' +
|
||||
' </ows:OperationsMetadata>' +
|
||||
' <wps:ProcessOfferings>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>gt:Intersect</ows:Identifier>' +
|
||||
' <ows:Title>Intersection</ows:Title>' +
|
||||
' <ows:Abstract>Intersection between two literal geometry</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:length</ows:Identifier>' +
|
||||
' <ows:Title>Returns the geometry perimeters, computed using cartesian geometry' +
|
||||
' expressions in the same unit of measure as the geometry (will not return a valid' +
|
||||
' perimeter for geometries expressed geographic coordinates</ows:Title>' +
|
||||
' <ows:Abstract>Returns the geometry perimeters, computed using cartesian geometry' +
|
||||
' expressions in the same unit of measure as the geometry (will not return a valid' +
|
||||
' perimeter for geometries expressed geographic coordinates</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:isEmpty</ows:Identifier>' +
|
||||
' <ows:Title>Checks if the provided geometry is empty</ows:Title>' +
|
||||
' <ows:Abstract>Checks if the provided geometry is empty</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:contains</ows:Identifier>' +
|
||||
' <ows:Title>Checks if a contains b</ows:Title>' +
|
||||
' <ows:Abstract>Checks if a contains b</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:disjoint</ows:Identifier>' +
|
||||
' <ows:Title>Returns true if the two geometries have no points in common</ows:Title>' +
|
||||
' <ows:Abstract>Returns true if the two geometries have no points in common</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:intersects</ows:Identifier>' +
|
||||
' <ows:Title>Returns true if the two geometries intersect, false otherwise</ows:Title>' +
|
||||
' <ows:Abstract>Returns true if the two geometries intersect, false' +
|
||||
' otherwise</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:isClosed</ows:Identifier>' +
|
||||
' <ows:Title>Returns true if the line is closed</ows:Title>' +
|
||||
' <ows:Abstract>Returns true if the line is closed</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:isValid</ows:Identifier>' +
|
||||
' <ows:Title>Returns true if the geometry is topologically valid, false' +
|
||||
' otherwise</ows:Title>' +
|
||||
' <ows:Abstract>Returns true if the geometry is topologically valid, false' +
|
||||
' otherwise</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:buffer</ows:Identifier>' +
|
||||
' <ows:Title>Buffers a geometry using a certain distance</ows:Title>' +
|
||||
' <ows:Abstract>Buffers a geometry using a certain distance</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' <wps:Process wps:processVersion="1.0.0">' +
|
||||
' <ows:Identifier>JTS:getY</ows:Identifier>' +
|
||||
' <ows:Title>Returns the Y ordinate of the point</ows:Title>' +
|
||||
' <ows:Abstract>Returns the Y ordinate of the point</ows:Abstract>' +
|
||||
' </wps:Process>' +
|
||||
' </wps:ProcessOfferings>' +
|
||||
' <wps:Languages>' +
|
||||
' <wps:Default>' +
|
||||
' <ows:Language>en-US</ows:Language>' +
|
||||
' </wps:Default>' +
|
||||
' <wps:Supported>' +
|
||||
' <ows:Language>en-US</ows:Language>' +
|
||||
' </wps:Supported>' +
|
||||
' </wps:Languages>' +
|
||||
'</wps:Capabilities>'
|
||||
);
|
||||
196
tests/Format/WPSDescribeProcess.html
Normal file
196
tests/Format/WPSDescribeProcess.html
Normal file
@@ -0,0 +1,196 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_read_WPSDescribeProcess(t) {
|
||||
t.plan(16);
|
||||
|
||||
var parser = new OpenLayers.Format.WPSDescribeProcess();
|
||||
var text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<wps:ProcessDescriptions xml:lang="en" service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"' +
|
||||
' xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
||||
' <ProcessDescription wps:processVersion="1.0.0" statusSupported="false"' +
|
||||
' storeSupported="false">' +
|
||||
' <ows:Identifier>JTS:buffer</ows:Identifier>' +
|
||||
' <ows:Title>Buffers a geometry using a certain distance</ows:Title>' +
|
||||
' <ows:Abstract>Buffers a geometry using a certain distance</ows:Abstract>' +
|
||||
' <DataInputs>' +
|
||||
' <Input maxOccurs="1" minOccurs="1">' +
|
||||
' <ows:Identifier>geom</ows:Identifier>' +
|
||||
' <ows:Title>geom</ows:Title>' +
|
||||
' <ows:Abstract>The geometry to be buffered</ows:Abstract>' +
|
||||
' <ComplexData>' +
|
||||
' <Default>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Default>' +
|
||||
' <Supported>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/2.1.2</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/wkt</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/gml-3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/gml-2.1.2</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Supported>' +
|
||||
' </ComplexData>' +
|
||||
' </Input>' +
|
||||
' <Input maxOccurs="1" minOccurs="1">' +
|
||||
' <ows:Identifier>distance</ows:Identifier>' +
|
||||
' <ows:Title>distance</ows:Title>' +
|
||||
' <ows:Abstract>The distance (same unit of measure as the geometry)</ows:Abstract>' +
|
||||
' <LiteralData>' +
|
||||
' <ows:DataType>xs:double</ows:DataType>' +
|
||||
' <ows:AnyValue/>' +
|
||||
' </LiteralData>' +
|
||||
' </Input>' +
|
||||
' <Input maxOccurs="1" minOccurs="0">' +
|
||||
' <ows:Identifier>quadrantSegments</ows:Identifier>' +
|
||||
' <ows:Title>quadrantSegments</ows:Title>' +
|
||||
' <ows:Abstract>Number of quadrant segments. Use > 0 for round joins, 0 for' +
|
||||
' flat joins, < 0 for mitred joins</ows:Abstract>' +
|
||||
' <LiteralData>' +
|
||||
' <ows:DataType>xs:int</ows:DataType>' +
|
||||
' <ows:AnyValue/>' +
|
||||
' </LiteralData>' +
|
||||
' </Input>' +
|
||||
' <Input maxOccurs="1" minOccurs="0">' +
|
||||
' <ows:Identifier>capStyle</ows:Identifier>' +
|
||||
' <ows:Title>capStyle</ows:Title>' +
|
||||
' <ows:Abstract>The buffer cap style, round, flat, square</ows:Abstract>' +
|
||||
' <LiteralData>' +
|
||||
' <ows:AllowedValues>' +
|
||||
' <ows:Value>Round</ows:Value>' +
|
||||
' <ows:Value>Flat</ows:Value>' +
|
||||
' <ows:Value>Square</ows:Value>' +
|
||||
' </ows:AllowedValues>' +
|
||||
' </LiteralData>' +
|
||||
' </Input>' +
|
||||
' </DataInputs>' +
|
||||
' <ProcessOutputs>' +
|
||||
' <Output>' +
|
||||
' <ows:Identifier>result</ows:Identifier>' +
|
||||
' <ows:Title>result</ows:Title>' +
|
||||
' <ComplexOutput>' +
|
||||
' <Default>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Default>' +
|
||||
' <Supported>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>text/xml; subtype=gml/2.1.2</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/wkt</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/gml-3.1.1</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/gml-2.1.2</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Supported>' +
|
||||
' </ComplexOutput>' +
|
||||
' </Output>' +
|
||||
' </ProcessOutputs>' +
|
||||
' </ProcessDescription>' +
|
||||
'</wps:ProcessDescriptions>';
|
||||
|
||||
var res = parser.read(text);
|
||||
var buffer = res.processDescriptions["JTS:buffer"];
|
||||
t.eq(buffer.statusSupported, false, "statusSupported read correctly");
|
||||
t.eq(buffer.storeSupported, false, "storeSupported read correctly");
|
||||
t.eq(buffer.processVersion, "1.0.0", "processVersion read correctly");
|
||||
var capStyle = buffer.dataInputs[3];
|
||||
t.eq(capStyle.abstract, "The buffer cap style, round, flat, square", "capStyle abstract read correctly");
|
||||
t.eq(capStyle.minOccurs, 0, "capStyle minOccurs read correctly");
|
||||
t.eq(capStyle.maxOccurs, 1, "maxOccurs read correctly");
|
||||
t.eq(capStyle.literalData.allowedValues["Flat"], true, "capStyle allowedValues read correctly");
|
||||
var distance = buffer.dataInputs[1];
|
||||
t.eq(distance.literalData.anyValue, true, "distance anyValue read correctly");
|
||||
t.eq(distance.literalData.dataType, "xs:double", "distance dataType read correctly");
|
||||
var geom = buffer.dataInputs[0];
|
||||
t.eq(geom.complexData["default"].formats["text/xml; subtype=gml/3.1.1"], true, "geom complexData default read correctly");
|
||||
t.eq(geom.complexData["supported"].formats["application/gml-2.1.2"], true, "geom complexData supported read correctly [1/2]");
|
||||
t.eq(geom.complexData["supported"].formats["application/gml-3.1.1"], true, "geom complexData supported read correctly [2/2]");
|
||||
var result = buffer.processOutputs[0];
|
||||
t.eq(result.complexOutput["default"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs default format read correctly");
|
||||
t.eq(result.complexOutput["supported"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs supported format read correctly [1/2]");
|
||||
t.eq(result.complexOutput["supported"].formats["application/wkt"], true, "processOutputs supported format read correctly [1/2]");
|
||||
|
||||
text = '<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<wps:ProcessDescriptions service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"' +
|
||||
' xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
||||
' <ProcessDescription wps:processVersion="1.0.0" statusSupported="false"' +
|
||||
' storeSupported="false">' +
|
||||
' <ows:Identifier>gt:VectorToRaster</ows:Identifier>' +
|
||||
' <ows:Title>Rasterize features</ows:Title>' +
|
||||
' <ows:Abstract>Rasterize all or selected features in a FeatureCollection</ows:Abstract>' +
|
||||
' <DataInputs>' +
|
||||
' <Input maxOccurs="1" minOccurs="0">' +
|
||||
' <ows:Identifier>bounds</ows:Identifier>' +
|
||||
' <ows:Title>Bounds</ows:Title>' +
|
||||
' <ows:Abstract>Bounds of the area to rasterize</ows:Abstract>' +
|
||||
' <BoundingBoxData>' +
|
||||
' <Default>' +
|
||||
' <CRS>EPSG:4326</CRS>' +
|
||||
' </Default>' +
|
||||
' <Supported>' +
|
||||
' <CRS>EPSG:4326</CRS>' +
|
||||
' </Supported>' +
|
||||
' </BoundingBoxData>' +
|
||||
' </Input>' +
|
||||
' </DataInputs>' +
|
||||
' <ProcessOutputs>' +
|
||||
' <Output>' +
|
||||
' <ows:Identifier>result</ows:Identifier>' +
|
||||
' <ows:Title>Result</ows:Title>' +
|
||||
' <ComplexOutput>' +
|
||||
' <Default>' +
|
||||
' <Format>' +
|
||||
' <MimeType>image/tiff</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Default>' +
|
||||
' <Supported>' +
|
||||
' <Format>' +
|
||||
' <MimeType>image/tiff</MimeType>' +
|
||||
' </Format>' +
|
||||
' <Format>' +
|
||||
' <MimeType>application/arcgrid</MimeType>' +
|
||||
' </Format>' +
|
||||
' </Supported>' +
|
||||
' </ComplexOutput>' +
|
||||
' </Output>' +
|
||||
' </ProcessOutputs>' +
|
||||
' </ProcessDescription>' +
|
||||
'</wps:ProcessDescriptions>';
|
||||
|
||||
res = parser.read(text);
|
||||
var vector2Raster = res.processDescriptions["gt:VectorToRaster"];
|
||||
t.eq(vector2Raster.dataInputs[0].boundingBoxData["default"].CRSs["EPSG:4326"], true, "BoundingBoxData CRS parsed correctly");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
364
tests/Format/WPSExecute.html
Normal file
364
tests/Format/WPSExecute.html
Normal file
@@ -0,0 +1,364 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_write_WPSExecute(t) {
|
||||
t.plan(1);
|
||||
var expected = '<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
|
||||
' xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs"' +
|
||||
' xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"' +
|
||||
' xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"' +
|
||||
' xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink"' +
|
||||
' xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
|
||||
' <ows:Identifier>JTS:area</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>geom</ows:Identifier>' +
|
||||
' <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="http://geoserver/wps"' +
|
||||
' method="POST">' +
|
||||
' <wps:Body>' +
|
||||
' <wps:Execute service="WPS" version="1.0.0">' +
|
||||
' <ows:Identifier>gs:CollectGeometries</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>features</ows:Identifier>' +
|
||||
' <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0"' +
|
||||
' xlink:href="http://geoserver/wfs" method="POST">' +
|
||||
' <wps:Body>' +
|
||||
' <wfs:GetFeature service="WFS" version="1.0.0"' +
|
||||
' outputFormat="GML2">' +
|
||||
' <wfs:Query typeName="sf:archsites"/>' +
|
||||
' </wfs:GetFeature>' +
|
||||
' </wps:Body>' +
|
||||
' </wps:Reference>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">' +
|
||||
' <ows:Identifier>result</ows:Identifier>' +
|
||||
' </wps:RawDataOutput>' +
|
||||
' </wps:ResponseForm>' +
|
||||
' </wps:Execute>' +
|
||||
' </wps:Body>' +
|
||||
' </wps:Reference>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:RawDataOutput>' +
|
||||
' <ows:Identifier>result</ows:Identifier>' +
|
||||
' </wps:RawDataOutput>' +
|
||||
' </wps:ResponseForm>' +
|
||||
'</wps:Execute>';
|
||||
|
||||
var format = new OpenLayers.Format.WPSExecute();
|
||||
var result = format.write({
|
||||
identifier: "JTS:area",
|
||||
dataInputs: [{
|
||||
identifier: 'geom',
|
||||
reference: {
|
||||
mimeType: "text/xml; subtype=gml/3.1.1",
|
||||
href: "http://geoserver/wps",
|
||||
method: "POST",
|
||||
body: {
|
||||
identifier: "gs:CollectGeometries",
|
||||
dataInputs: [{
|
||||
identifier: 'features',
|
||||
reference: {
|
||||
mimeType: "text/xml; subtype=wfs-collection/1.0",
|
||||
href: "http://geoserver/wfs",
|
||||
method: "POST",
|
||||
body: {
|
||||
wfs: {
|
||||
version: "1.0.0",
|
||||
outputFormat: "GML2",
|
||||
featureType: "sf:archsites"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
rawDataOutput: {
|
||||
mimeType: "text/xml; subtype=gml/3.1.1",
|
||||
identifier: "result"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
rawDataOutput: {
|
||||
identifier: "result"
|
||||
}
|
||||
}
|
||||
});
|
||||
t.xml_eq(result, expected, "WPS Execute written out correctly");
|
||||
}
|
||||
|
||||
function test_write_raw_data_output(t) {
|
||||
t.plan(1);
|
||||
// example request taken from: http://geoprocessing.info/wpsdoc/1x0ExecutePOST
|
||||
var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
|
||||
'<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0' +
|
||||
' http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
|
||||
' <ows:Identifier>Buffer</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>InputPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Playground area</ows:Title>' +
|
||||
' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml"/>' +
|
||||
' </wps:Input>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>BufferDistance</ows:Identifier>' +
|
||||
' <ows:Title>Distance which people will walk to get to a playground.</ows:Title>' +
|
||||
' <wps:Data>' +
|
||||
' <wps:LiteralData>400</wps:LiteralData>' +
|
||||
' </wps:Data>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:RawDataOutput>' +
|
||||
' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
|
||||
' </wps:RawDataOutput>' +
|
||||
' </wps:ResponseForm>' +
|
||||
'</wps:Execute>';
|
||||
|
||||
var format = new OpenLayers.Format.WPSExecute();
|
||||
var result = format.write({
|
||||
identifier: "Buffer",
|
||||
dataInputs: [{
|
||||
identifier: 'InputPolygon',
|
||||
title: 'Playground area',
|
||||
reference: {
|
||||
href: 'http://foo.bar/some_WFS_request.xml'
|
||||
}
|
||||
}, {
|
||||
identifier: 'BufferDistance',
|
||||
title: 'Distance which people will walk to get to a playground.',
|
||||
data: {
|
||||
literalData: {
|
||||
value: 400
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
rawDataOutput: {
|
||||
identifier: "BufferedPolygon"
|
||||
}
|
||||
}
|
||||
});
|
||||
t.xml_eq(result, expected, "WPS Execute written out correctly");
|
||||
}
|
||||
|
||||
function test_write_request_responseDoc_defaultFormat(t) {
|
||||
t.plan(1);
|
||||
// taken from http://geoprocessing.info/schemas/wps/1.0/examples/51_wpsExecute_request_ResponseDocument.xml
|
||||
var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
|
||||
'<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0' +
|
||||
' http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
|
||||
' <ows:Identifier>Buffer</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>InputPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Playground area</ows:Title>' +
|
||||
' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml"/>' +
|
||||
' </wps:Input>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>BufferDistance</ows:Identifier>' +
|
||||
' <ows:Title>Distance which people will walk to get to a playground.</ows:Title>' +
|
||||
' <wps:Data>' +
|
||||
' <wps:LiteralData>400</wps:LiteralData>' +
|
||||
' </wps:Data>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:ResponseDocument storeExecuteResponse="true">' +
|
||||
' <wps:Output asReference="true">' +
|
||||
' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Area serviced by playground.</ows:Title>' +
|
||||
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
|
||||
' </wps:Output>' +
|
||||
' </wps:ResponseDocument>' +
|
||||
' </wps:ResponseForm>' +
|
||||
'</wps:Execute>';
|
||||
|
||||
var format = new OpenLayers.Format.WPSExecute();
|
||||
var result = format.write({
|
||||
identifier: "Buffer",
|
||||
dataInputs: [{
|
||||
identifier: 'InputPolygon',
|
||||
title: 'Playground area',
|
||||
reference: {
|
||||
href: 'http://foo.bar/some_WFS_request.xml'
|
||||
}
|
||||
}, {
|
||||
identifier: 'BufferDistance',
|
||||
title: 'Distance which people will walk to get to a playground.',
|
||||
data: {
|
||||
literalData: {
|
||||
value: 400
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
responseDocument: {
|
||||
storeExecuteResponse: true,
|
||||
output: {
|
||||
asReference: true,
|
||||
identifier: 'BufferedPolygon',
|
||||
title: 'Area serviced by playground.',
|
||||
'abstract': 'Area within which most users of this playground will live.'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
t.xml_eq(result, expected, "WPS Execute written out correctly");
|
||||
}
|
||||
|
||||
function test_write_request_responseDoc_specifiedFormat(t) {
|
||||
t.plan(1);
|
||||
// taken from http://geoprocessing.info/schemas/wps/1.0/examples/52_wpsExecute_request_ResponseDocument.xml
|
||||
var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
|
||||
'<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0' +
|
||||
' http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
|
||||
' <ows:Identifier>Buffer</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>InputPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Playground area</ows:Title>' +
|
||||
' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml" method="POST" mimeType="text/xml" encoding="UTF-8" schema="http://foo.bar/gml_polygon_schema.xsd"/>' +
|
||||
' </wps:Input>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>BufferDistance</ows:Identifier>' +
|
||||
' <ows:Title>Distance which people will walk to get to a playground.</ows:Title>' +
|
||||
' <wps:Data>' +
|
||||
' <wps:LiteralData uom="feet">400</wps:LiteralData>' +
|
||||
' </wps:Data>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:ResponseDocument storeExecuteResponse="true" lineage="true" status="true">' +
|
||||
' <wps:Output asReference="true">' +
|
||||
' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Area serviced by playground.</ows:Title>' +
|
||||
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
|
||||
' </wps:Output>' +
|
||||
' </wps:ResponseDocument>' +
|
||||
' </wps:ResponseForm>' +
|
||||
'</wps:Execute>';
|
||||
|
||||
var format = new OpenLayers.Format.WPSExecute();
|
||||
var result = format.write({
|
||||
identifier: "Buffer",
|
||||
dataInputs: [{
|
||||
identifier: 'InputPolygon',
|
||||
title: 'Playground area',
|
||||
reference: {
|
||||
href: 'http://foo.bar/some_WFS_request.xml',
|
||||
method: "POST",
|
||||
mimeType: "text/xml",
|
||||
encoding: "UTF-8",
|
||||
schema: "http://foo.bar/gml_polygon_schema.xsd"
|
||||
}
|
||||
}, {
|
||||
identifier: 'BufferDistance',
|
||||
title: 'Distance which people will walk to get to a playground.',
|
||||
data: {
|
||||
literalData: {
|
||||
value: 400,
|
||||
uom: 'feet'
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
responseDocument: {
|
||||
storeExecuteResponse: true,
|
||||
lineage: true,
|
||||
status: true,
|
||||
output: {
|
||||
asReference: true,
|
||||
identifier: 'BufferedPolygon',
|
||||
title: 'Area serviced by playground.',
|
||||
'abstract': 'Area within which most users of this playground will live.'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
t.xml_eq(result, expected, "WPS Execute written out correctly");
|
||||
}
|
||||
|
||||
function test_write_request_complexData(t) {
|
||||
t.plan(1);
|
||||
// taken from http://geoprocessing.info/schemas/wps/1.0/examples/51_wpsExecute_request_ResponseDocument.xml
|
||||
var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
|
||||
'<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0' +
|
||||
' http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
|
||||
' <ows:Identifier>Buffer</ows:Identifier>' +
|
||||
' <wps:DataInputs>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>InputPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Playground area</ows:Title>' +
|
||||
' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml"/>' +
|
||||
' </wps:Input>' +
|
||||
' <wps:Input>' +
|
||||
' <ows:Identifier>ResultPage</ows:Identifier>' +
|
||||
' <ows:Title>Nicely formatted HTML of the result</ows:Title>' +
|
||||
' <wps:Data>' +
|
||||
' <wps:ComplexData><![CDATA[<html><head></head><body></body></head>]]></wps:ComplexData>' +
|
||||
' </wps:Data>' +
|
||||
' </wps:Input>' +
|
||||
' </wps:DataInputs>' +
|
||||
' <wps:ResponseForm>' +
|
||||
' <wps:ResponseDocument storeExecuteResponse="true">' +
|
||||
' <wps:Output asReference="true">' +
|
||||
' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
|
||||
' <ows:Title>Area serviced by playground.</ows:Title>' +
|
||||
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
|
||||
' </wps:Output>' +
|
||||
' </wps:ResponseDocument>' +
|
||||
' </wps:ResponseForm>' +
|
||||
'</wps:Execute>';
|
||||
|
||||
var format = new OpenLayers.Format.WPSExecute();
|
||||
var result = format.write({
|
||||
identifier: "Buffer",
|
||||
dataInputs: [{
|
||||
identifier: 'InputPolygon',
|
||||
title: 'Playground area',
|
||||
reference: {
|
||||
href: 'http://foo.bar/some_WFS_request.xml'
|
||||
}
|
||||
}, {
|
||||
identifier: 'ResultPage',
|
||||
title: 'Nicely formatted HTML of the result',
|
||||
data: {
|
||||
complexData: {
|
||||
value: "<html><head></head><body></body></head>"
|
||||
}
|
||||
}
|
||||
}],
|
||||
responseForm: {
|
||||
responseDocument: {
|
||||
storeExecuteResponse: true,
|
||||
output: {
|
||||
asReference: true,
|
||||
identifier: 'BufferedPolygon',
|
||||
title: 'Area serviced by playground.',
|
||||
'abstract': 'Area within which most users of this playground will live.'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
t.xml_eq(result, expected, "WPS Execute written out correctly");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -96,6 +96,9 @@
|
||||
<li>Format/WMSGetFeatureInfo.html</li>
|
||||
<li>Format/WMTSCapabilities.html</li>
|
||||
<li>Format/WMTSCapabilities/v1_0_0.html</li>
|
||||
<li>Format/WPSCapabilities/v1_0_0.html</li>
|
||||
<li>Format/WPSDescribeProcess.html</li>
|
||||
<li>Format/WPSExecute.html</li>
|
||||
<li>Format/CSWGetDomain.html</li>
|
||||
<li>Format/CSWGetDomain/v2_0_2.html</li>
|
||||
<li>Format/CSWGetRecords.html</li>
|
||||
|
||||
Reference in New Issue
Block a user