add Format for writing out Web Coverage Service (WCS) requests, r=ahocevar (closes #3375)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12125 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-06-22 15:20:01 +00:00
parent 1aa76f6de6
commit d1009b92ad
6 changed files with 394 additions and 2 deletions

View File

@@ -0,0 +1,80 @@
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_write_WCSGetCoverage(t) {
t.plan(1);
var expected = '<?xml version="1.0" encoding="UTF-8"?>' +
'<GetCoverage xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/wcs/1.1 http://schemas.opengis.net/wcs/1.1/wcsGetCoverage.xsd"' +
' service="WCS" version="1.1.2">' +
' <ows:Identifier>Cov123</ows:Identifier>' +
' <DomainSubset>' +
' <ows:BoundingBox crs="urn:ogc:def:crs:OGC:2:84">' +
' <ows:LowerCorner>-71 47</ows:LowerCorner>' +
' <ows:UpperCorner>-66 51</ows:UpperCorner>' +
' </ows:BoundingBox>' +
' <TemporalSubset>' +
' <TimePeriod>' +
' <BeginPosition>2006-08-01</BeginPosition>' +
' <EndPosition>2006-09-01</EndPosition>' +
' <TimeResolution>P1D</TimeResolution>' +
' </TimePeriod>' +
' <TimePeriod>' +
' <BeginPosition>2007-08-01</BeginPosition>' +
' <EndPosition>2007-09-01</EndPosition>' +
' <TimeResolution>P1D</TimeResolution>' +
' </TimePeriod>' +
' </TemporalSubset>' +
' </DomainSubset>' +
' <Output format="image/netcdf">' +
' <GridCRS>' +
' <GridBaseCRS>urn:ogc:def:crs:EPSG:6.6:32618</GridBaseCRS>' +
' <GridType>urn:ogc:def:method:WCS:1.1:2dGridin2dCrs</GridType>' +
' <GridOrigin>3000 4000</GridOrigin>' +
' <GridOffsets>6.0 8.0 -8.0 6.0</GridOffsets>' +
' <GridCS>urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS</GridCS>' +
' </GridCRS>' +
' </Output>' +
'</GetCoverage>';
var format = new OpenLayers.Format.WCSGetCoverage();
var result = format.write({
identifier: 'Cov123',
domainSubset: {
boundingBox: {projection: 'urn:ogc:def:crs:OGC:2:84', bounds: new OpenLayers.Bounds(-71, 47, -66, 51)},
temporalSubset: {
timePeriods: [
{
begin: '2006-08-01',
end: '2006-09-01',
resolution: 'P1D'
}, {
begin: '2007-08-01',
end: '2007-09-01',
resolution: 'P1D'
}
]
}
},
output: {
format: 'image/netcdf',
gridCRS: {
baseCRS: 'urn:ogc:def:crs:EPSG:6.6:32618',
type: 'urn:ogc:def:method:WCS:1.1:2dGridin2dCrs',
origin: '3000 4000',
offsets: '6.0 8.0 -8.0 6.0',
CS: 'urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS'
}
}
});
t.xml_eq(result, expected, "WCS GetCoverage written out correctly");
}
</script>
</head>
<body>
</body>
</html>

View File

@@ -3,6 +3,111 @@
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_write_WPSExecute_WCS(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" 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>gs:GeorectifyCoverage</ows:Identifier>' +
' <wps:DataInputs>' +
' <wps:Input>' +
' <ows:Identifier>data</ows:Identifier>' +
' <wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">' +
' <wps:Body>' +
' <wcs:GetCoverage service="WCS" version="1.1.2">' +
' <ows:Identifier>topp:asbuilt</ows:Identifier>' +
' <wcs:DomainSubset>' +
' <ows:BoundingBox crs="http://www.opengis.net/gml/srs/epsg.xml#404000">' +
' <ows:LowerCorner>0 -7070</ows:LowerCorner>' +
' <ows:UpperCorner>10647 1</ows:UpperCorner>' +
' </ows:BoundingBox>' +
' </wcs:DomainSubset>' +
' <wcs:Output format="image/tiff"/>' +
' </wcs:GetCoverage>' +
' </wps:Body>' +
' </wps:Reference>' +
' </wps:Input>' +
' <wps:Input>' +
' <ows:Identifier>gcp</ows:Identifier>' +
' <wps:Data>' +
' <wps:LiteralData>[[[2721, 3263], [-122.472109, 37.73106003]], [[4163, 3285], [-122.4693417, 37.729929851]], [[5773, 4046], [-122.466702461, 37.7271906]], [[8885, 4187], [-122.462333, 37.725167]]]</wps:LiteralData>' +
' </wps:Data>' +
' </wps:Input>' +
' <wps:Input>' +
' <ows:Identifier>targetCRS</ows:Identifier>' +
' <wps:Data>' +
' <wps:LiteralData>EPSG:4326</wps:LiteralData>' +
' </wps:Data>' +
' </wps:Input>' +
' <wps:Input>' +
' <ows:Identifier>transparent</ows:Identifier>' +
' <wps:Data>' +
' <wps:LiteralData>true</wps:LiteralData>' +
' </wps:Data>' +
' </wps:Input>' +
' </wps:DataInputs>' +
' <wps:ResponseForm>' +
' <wps:RawDataOutput mimeType="image/tiff">' +
' <ows:Identifier>result</ows:Identifier>' +
' </wps:RawDataOutput>' +
' </wps:ResponseForm>' +
'</wps:Execute>';
var format = new OpenLayers.Format.WPSExecute();
var result = format.write({
identifier: "gs:GeorectifyCoverage",
dataInputs: [{
identifier: 'data',
reference: {
mimeType: "image/tiff",
href: "http://geoserver/wcs",
method: "POST",
body: {
wcs: {
identifier: 'topp:asbuilt',
version: '1.1.2',
domainSubset: {
boundingBox: {
projection: 'http://www.opengis.net/gml/srs/epsg.xml#404000',
bounds: new OpenLayers.Bounds(0.0, -7070.0, 10647.0, 1.0)
},
},
output: {format: 'image/tiff'}
}
}
}
}, {
identifier: 'gcp',
data: {
literalData: {
value: '[[[2721, 3263], [-122.472109, 37.73106003]], [[4163, 3285], [-122.4693417, 37.729929851]], [[5773, 4046], [-122.466702461, 37.7271906]], [[8885, 4187], [-122.462333, 37.725167]]]'
}
}
}, {
identifier: 'targetCRS',
data: {
literalData: {
value: 'EPSG:4326'
}
}
}, {
identifier: 'transparent',
data: {
literalData: {
value: 'true'
}
}
}],
responseForm: {
rawDataOutput: {
mimeType: "image/tiff",
identifier: "result"
}
}
});
t.xml_eq(result, expected, "WPS Execute with embedded WCS GetCoverage written out correctly");
}
function test_write_WPSExecute(t) {
t.plan(1);
var expected = '<?xml version="1.0" encoding="UTF-8"?>' +

View File

@@ -111,6 +111,7 @@
<li>Format/OWSCommon/v1_1_0.html</li>
<li>Format/OGCExceptionReport.html</li>
<li>Format/XLS/v1_1_0.html</li>
<li>Format/WCSGetCoverage.html</li>
<li>Format/XML.html</li>
<li>Geometry.html</li>
<li>Geometry/Collection.html</li>