|
|
@@ -5,10 +5,11 @@ Lib::loadClass('Api_WfsNs');
|
|
|
Lib::loadClass('Request');
|
|
|
Lib::loadClass('Core_AclHelper');
|
|
|
Lib::loadClass('Core_XmlWriter');
|
|
|
+Lib::loadClass('Type_WpsProcess');
|
|
|
|
|
|
class Api_WpsV1_DescribeProcess {
|
|
|
|
|
|
- static function sendDescribeProcessXml($wpsServerUrl, $identifier) {
|
|
|
+ static function sendDescribeProcessXml($wpsServerUrl, Type_WpsProcess $wpsProcess) {
|
|
|
header('Content-type: application/xml; charset=utf-8');
|
|
|
|
|
|
$xmlWriter = new Core_XmlWriter();
|
|
|
@@ -32,7 +33,6 @@ class Api_WpsV1_DescribeProcess {
|
|
|
// $schemaLocations = [];
|
|
|
//$schemaLocations[] = 'http://www.opengis.net/wfs http://webgis.regione.sardegna.it:80/geoserver/schemas/wfs/1.0.0/WFS-capabilities.xsd';// @from http://webgis.regione.sardegna.it/geoserver/ows?service=WFS&request=GetCapabilities
|
|
|
// if (!empty($schemaLocations)) $xmlWriter->writeAttribute('xsi:schemaLocation', implode(' ', $schemaLocations));
|
|
|
- $wpsProcess = self::getWpsProcess($identifier);
|
|
|
$xmlWriter->h('ProcessDescription', [
|
|
|
[ 'ows:Identifier', $wpsProcess->identifier ],
|
|
|
[ 'ows:Title', $wpsProcess->title ],
|
|
|
@@ -63,10 +63,10 @@ class Api_WpsV1_DescribeProcess {
|
|
|
[ 'ows:Title', "result" ],
|
|
|
[ 'ComplexOutput', [
|
|
|
[ 'Default', [
|
|
|
- [ 'Format', [ [ 'MimeType', $wpsProcess->defaultOutput ] ] ],
|
|
|
+ [ 'Format', self::convertOutputToWpsFormatXml($wpsProcess->defaultOutput) ],
|
|
|
] ],
|
|
|
[ 'Supported', array_map(function ($output) {
|
|
|
- return [ 'Format', [ [ 'MimeType', $output ] ] ];
|
|
|
+ return [ 'Format', self::convertOutputToWpsFormatXml($output) ];
|
|
|
}, $wpsProcess->supportedOutput) ],
|
|
|
// [ 'Supported', [
|
|
|
// [ 'Format', [ [ 'MimeType', "text/xml; subtype=wfs-collection/1.0" ] ] ],
|
|
|
@@ -86,33 +86,14 @@ class Api_WpsV1_DescribeProcess {
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
- static function getWpsProcess($identifier) { // TODO: get from WPS Process Factory // @return Type_WpsProcess
|
|
|
- $wpsProcess = (object)[
|
|
|
- 'identifier' => $identifier,
|
|
|
- 'title' => "Title({$identifier})",
|
|
|
- 'description' => "Desc($identifier)",
|
|
|
- 'maxOccurs' => "1",
|
|
|
- 'minOccurs' => "1",
|
|
|
- 'dataInputs' => [
|
|
|
- (object)[
|
|
|
- 'identifier' => $identifier,
|
|
|
- 'title' => $title,
|
|
|
- 'description' => $description,
|
|
|
- 'type' => 'literal',
|
|
|
- ],
|
|
|
- ],
|
|
|
- // 'MimeType' => text/xml, 'Encoding' => base64, 'Schema' => http://foo.bar/gml/3.1.0/polygon.xsd
|
|
|
- 'defaultOutput' => [ 'MimeType' => "text/xml; subtype=wfs-collection/1.0" ],
|
|
|
- 'supportedOutput' => [
|
|
|
- [ 'MimeType' => "text/xml; subtype=wfs-collection/1.0" ],
|
|
|
- [ 'MimeType' => "text/xml; subtype=wfs-collection/1.1" ],
|
|
|
- [ 'MimeType' => "application/json" ],
|
|
|
- [ 'MimeType' => "application/wfs-collection-1.0" ],
|
|
|
- [ 'MimeType' => "application/wfs-collection-1.1" ],
|
|
|
- [ 'MimeType' => "application/zip" ],
|
|
|
- ]
|
|
|
- ];
|
|
|
- return $wpsProcess;
|
|
|
+ static function convertOutputToWpsFormatXml($output) {
|
|
|
+ // 'MimeType' => text/xml, 'Encoding' => base64, 'Schema' => http://foo.bar/gml/3.1.0/polygon.xsd
|
|
|
+ // return <MimeType>text/xml</MimeType><Encoding>base64</Encoding><Schema>http://foo.bar/gml/3.1.0/polygon.xsd</Schema>
|
|
|
+ return array_merge(
|
|
|
+ (!empty($output['MimeType'])) ? [ [ 'MimeType', $output['MimeType'] ] ] : [],
|
|
|
+ (!empty($output['Encoding'])) ? [ [ 'Encoding', $output['Encoding'] ] ] : [],
|
|
|
+ (!empty($output['Schema'])) ? [ [ 'Schema', $output['Schema'] ] ] : []
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
}
|