getNamespace());
return implode($csvValueSepartor, [
"p5_{$ns['prefix']}:{$ns['name']}", // Name
$csvText($acl->getRawLabel()), // Title
Api_WfsNs::getNsUri($ns['prefix']), // namespace url
$csvText(implode(', ', [ $acl->getID(), $acl->getName(), $acl->getRawLabel() ])), // Keywords
$csvText($acl->getRawOpis()), // Abstract
'EPSG:4326', // SRS
"8.12328509871721", // LatLongBoundingBox - minx
"38.8575126897477", // LatLongBoundingBox - miny
"9.838674658246807", // LatLongBoundingBox - maxx
"41.31378404137082", // LatLongBoundingBox - maxy
]);
}, $wpsProcessList));
echo $csvLineSepartor;
echo implode($csvLineSepartor, array_map(function ($typeName) use ($csvText, $csvValueSepartor) {
list($prefix, $name) = explode(':', $typeName);
return implode($csvValueSepartor, [
"p5_{$prefix}:{$name}", // Name
$csvText($name), // Title
Api_WfsNs::getNsUri($prefix), // namespace url
$csvText($name), // Keywords
$csvText($name), // Abstract
'EPSG:4326', // SRS
"8.12328509871721", // LatLongBoundingBox - minx
"38.8575126897477", // LatLongBoundingBox - miny
"9.838674658246807", // LatLongBoundingBox - maxx
"41.31378404137082", // LatLongBoundingBox - maxy
]);
}, Core_AclHelper::getCustomAclList()));
exit;
}
static function sendGetCapabilitiesHtml($wpsServerUrl, $serviceTitle, $serviceDescription, $wpsProcessList) {
header('Content-type: text/html; charset=utf-8');
Lib::loadClass('UI');
UI::layout(function () use ($wpsServerUrl, $serviceTitle, $serviceDescription, $wpsProcessList) {
echo UI::h('h1', [], "WPS GetCapabilities (v 1.0.0)");
UI::setTitle("WPS GetCapabilities (v 1.0.0)");
echo UI::h('ul', [], array_map(function ($wpsProcess) {
return UI::h('li', [], [
UI::h('a', [ 'href' => "wps.php?SERVICE=WPS&REQUEST=DescribeProcess&VERSION=1.0.0&IDENTIFIER={$wpsProcess->identifier}" ], $wpsProcess->identifier),
UI::h('span', [ 'style' => "margin-left: 6px; color:silver" ], $wpsProcess->title),
UI::h('pre', [ 'style' => "display:none" ], var_export($wpsProcess, true)),
]);
}, $wpsProcessList));
}, [ 'showMenu' => false ]);
}
static function sendGetCapabilitiesXml($wpsServerUrl, $serviceTitle, $serviceDescription, $wpsProcessList) {
header('Content-type: application/xml; charset=utf-8');
$xmlWriter = new Core_XmlWriter();
if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
$xmlWriter->openUri('php://output');
$xmlWriter->setIndent(true);
$xmlWriter->startDocument('1.0','UTF-8');
$xmlWriter->startElement('wps:Capabilities');
$xmlWriter->writeAttribute('service', "WPS");
$xmlWriter->writeAttribute('version', "1.0.0");
// $xmlWriter->writeAttribute('xml:lang', "en-GB");
$xmlWriter->writeAttribute('xmlns:xlink', "http://www.w3.org/1999/xlink");
$xmlWriter->writeAttribute('xmlns:wps', "http://www.opengis.net/wps/1.0.0");
$xmlWriter->writeAttribute('xmlns:ows', "http://www.opengis.net/ows/1.1");
$xmlWriter->writeAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
// $xmlWriter->writeAttribute('xsi:schemaLocation', "http://www.opengis.net/wps/1.0.0 ../wpsGetCapabilities_response.xsd");
$xmlWriter->writeAttribute('updateSequence', "1");
$xmlWriter->writeAttribute('xmlns:ogc', "http://www.opengis.net/ogc");
// $xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
// $xmlWriter->writeAttribute('xmlns:ogc', 'http://www.opengis.net/ogc');
// $xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
foreach (Api_WfsNs::getNsList() as $uri => $prefix) {
$xmlWriter->writeAttribute("xmlns:{$prefix}", $uri);
}
$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));
$xmlWriter->h('ows:ServiceIdentification', [
['ows:Title', $serviceTitle],
['ows:Abstract', $serviceDescription],
['ows:Keywords', [
['ows:Keyword', "WPS"],
] ],
['ows:ServiceType', "WPS"],
['ows:ServiceTypeVersion', "1.0.0"],
// ['ows:Profile', ...],
// Unordered list of identifiers of Application Profiles that are implemented by this server.
// This element should be included for each specified application profile implemented by this server.
// The identifier value should be specified by each Application Profile. If this element is omitted, no meaning is implied.
// ['ows:Fees', "NONE"],
// ['ows:AccessConstraints', "NONE"], // @from xsd: Unordered list of access constraints applied to assure the protection of privacy or intellectual property,
// and any other restrictions on retrieving or using data from or otherwise using this server.
// The reserved value NONE (case insensitive) shall be used to mean no access constraints are imposed.
// When this element is omitted, no meaning is implied.
]);
// @from http://schemas.opengis.net/wps/1.0.0/examples/20_wpsGetCapabilities_response.xml
//
// Agriculture and Agri-Food Canada
//
//
// Peter Schut
// Information System Scientist
//
//
// +1 613 759-1874
// +1 613 759-1937
//
//
// Room 1135, Neatby Building, 960, Carling Avenue
// Ottawa
// ON
// K1AOC6
// Canada
// schutp@agr.gc.ca
//
//
//
//
$xmlWriter->h('ows:ServiceProvider', [
[ 'ows:ProviderName', $_SERVER['SERVER_NAME'] ], // TODO: company name - from config?
[ 'ows:ProviderSite', [ 'xlink:href' => $wpsServerUrl ], null ],
// [ 'ows:ServiceContact', [
// [ 'ows:IndividualName', "..." ],
// ] ],
]);
$xmlWriter->h('ows:OperationsMetadata', [
[ 'ows:Operation', [ 'name' => "GetCapabilities" ], [
[ 'ows:DCP', [
[ 'ows:HTTP', [
[ 'ows:Get', [ 'xlink:href' => $wpsServerUrl ], null ],
] ]
] ]
] ],
[ 'ows:Operation', [ 'name' => "DescribeProcess" ], [
[ 'ows:DCP', [
[ 'ows:HTTP', [
[ 'ows:Get', [ 'xlink:href' => $wpsServerUrl ], null ],
// [ 'ows:Post', [ 'xlink:href' => $wpsServerUrl ], null ], // TODO: POST xml with DescribeProcess
] ]
] ]
] ],
[ 'ows:Operation', [ 'name' => "Execute" ], [
[ 'ows:DCP', [
[ 'ows:HTTP', [
[ 'ows:Get', [ 'xlink:href' => $wpsServerUrl ], null ],
// [ 'ows:Post', [ 'xlink:href' => $wpsServerUrl ], null ], // TODO: POST xml with DescribeProcess
] ]
] ]
] ],
]);
// @from http://schemas.opengis.net/wps/1.0.0/examples/20_wpsGetCapabilities_response.xml
//
//
// buffer
// Buffer a polygon feature
// Buffer the polygon coordinates found in one GML stream by a given buffer distance, and output the results in GML.
//
//
//
//
//
//
// en-CA
//
//
// en-CA
// fr-CA
//
//
//
$xmlWriter->h('wps:ProcessOfferings', array_map(function ($wpsProcess) {
return [ 'wps:Process', [ 'wps:processVersion' => $wpsProcess->processVersion ], [
[ 'ows:Identifier', $wpsProcess->identifier ],
[ 'ows:Title', $wpsProcess->title ],
[ 'ows:Abstract', $wpsProcess->description ],
] ];
}, $wpsProcessList));
// $xmlWriter->h('wps:ProcessOfferings', [
// [ 'wps:Process', [ 'wps:processVersion' => "1.0.0" ], [
// [ 'ows:Identifier', "buffer" ],
// [ 'ows:Title', "Buffer a polygon feature" ],
// [ 'ows:Abstract', "Buffer the polygon coordinates found in one GML stream by a given buffer distance, and output the results in GML." ],
// ] ],
// [ 'wps:Process', [ 'wps:processVersion' => "1.0.0" ], [
// [ 'ows:Identifier', "JTS:area" ],
// [ 'ows:Title', "Area" ],
// [ 'ows:Abstract', "Returns the area of a geometry, in the units of the geometry. Assumes a Cartesian plane, so this process is only recommended for non-geographic CRSes." ],
// ] ]
// ]);
$xmlWriter->h('wps:Languages', [
[ 'wps:Default', [
[ 'ows:Language', "en-GB" ],
] ],
[ 'wps:Supported', [
[ 'ows:Language', "pl-PL" ],
] ]
]);
// $xmlWriter->h('wps:Contents', [
// [ 'wps:ProcessSummary', [ 'jobControlOptions' => "sync-execute async-execute dismiss" ], [
// [ 'ows:Title', "example 1" ],
// [ 'ows:Identifier', "{$wpsServerUrl}/task/example1" ],
// ] ],
// [ 'wps:ProcessSummary', [ 'jobControlOptions' => "async-execute dismiss", 'processVersion' => "1.4.0" ], [
// [ 'ows:Title', "example 2" ],
// [ 'ows:Identifier', "{$wpsServerUrl}/task/example2" ],
// ] ],
// ]);
// $xmlWriter->h('wps:WSDL', [ 'xlink:href' => "http://foo.bar/wps?WSDL" ], null);
$xmlWriter->endElement();// WFS_Capabilities
$xmlWriter->endDocument();
exit;
}
}