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:
bartvde
2011-06-22 09:54:35 +00:00
parent 39d9715853
commit 1aa76f6de6
12 changed files with 1386 additions and 1 deletions
+30
View 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
View 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
View 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 &gt; 0 for round joins, 0 for' +
' flat joins, &lt; 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
View 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>
+3
View File
@@ -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>