[Mapbender-commits] r10281 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Oct 2 04:44:04 PDT 2019
Author: armin11
Date: 2019-10-02 04:44:04 -0700 (Wed, 02 Oct 2019)
New Revision: 10281
Modified:
trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
trunk/mapbender/http/php/mod_getDownloadOptions.php
Log:
Add openapi 3.0 json link to download options
Modified: trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_featuretypeISOMetadata.php 2019-10-02 07:08:15 UTC (rev 10280)
+++ trunk/mapbender/http/php/mod_featuretypeISOMetadata.php 2019-10-02 11:44:04 UTC (rev 10281)
@@ -31,17 +31,36 @@
require_once(dirname(__FILE__) . "/../classes/class_XmlBuilder.php");
require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
require_once(dirname(__FILE__)."/../classes/class_qualityReport.php");
-/*
-*/
+if (file_exists(dirname(__FILE__)."/../../conf/linkedDataProxy.json")) {
+ $configObject = json_decode(file_get_contents("../../conf/linkedDataProxy.json"));
+}
+if (isset($configObject) && isset($configObject->behind_rewrite) && $configObject->behind_rewrite == true) {
+ $behindRewrite = true;
+} else {
+ $behindRewrite = false;
+}
+if (isset($configObject) && isset($configObject->rewrite_path) && $configObject->rewrite_path != "") {
+ $rewritePath = $configObject->rewrite_path;
+} else {
+ $rewritePath = "linkedDataProxy";
+}
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
global $serviceType;
global $serviceTypeTitle;
+global $ogcApiFeaturesUrl;
+
+if (!empty($_SERVER['HTTPS'])) {
+ $schema = "https";
+} else {
+ $schema = "http";
+}
+
if (DEFINED("MAPBENDER_PATH") && MAPBENDER_PATH !== "") {
$mapbenderServiceUrl = MAPBENDER_PATH."/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=";
} else {
- $mapbenderServiceUrl = $_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=";
+ $mapbenderServiceUrl = $schema."://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=";
}
$admin = new administration();
@@ -118,6 +137,14 @@
echo 'Parameter <b>validate</b> is not valid (true).<br/>';
die();
}
+
+if ($serviceType == "ogcapifeatures") {
+ if ($behindRewrite) {
+ $ogcApiFeaturesUrl = $schema."://".$_SERVER['HTTP_HOST']."/".$rewritePath;
+ } else {
+ $ogcApiFeaturesUrl = MAPBENDER_PATH."/php/mod_linkedDataProxy.php?";
+ }
+}
//some needfull functions to pull metadata out of the database!
function fillISO19139(XmlBuilder $xmlBuilder, $recordId) {
global $wmsView;
@@ -125,6 +152,7 @@
global $admin;
global $serviceType;
global $serviceTypeTitle;
+ global $ogcApiFeaturesUrl;
//read out relevant information from mapbender database:
if ($wmsView != '') {
$sql = "SELECT * ";
@@ -399,10 +427,23 @@
'./gmd:identificationInfo/srv:SV_ServiceIdentification/srv:couplingType/srv:SV_CouplingType',
"tight");
}
-
+
+ switch ($serviceType) {
+ case "wfs":
+ $url = $mapbenderServiceUrl.$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$mbMeta['wfs_version'];
+ $protocol = "OGC:WFS-".$mbMeta['wfs_version']."-http-get-feature";
+ $operation = "GetCapabilities";
+ break;
+ case "ogcapifeatures":
+ $url = $ogcApiFeaturesUrl."/".$mbMeta['wfs_id']."/api";
+ $protocol = "OGC:API:Features";
+ $operation = "getApiDescription";
+ break;
+ }
+
$xmlBuilder->addValue($MD_Metadata,
'./gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:operationName/gco:CharacterString',
- "GetCapabilities");
+ $operation);
$xmlBuilder->addValue($MD_Metadata,
'./gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:DCP/srv:DCPList/@codeListValue',
"WebServices");
@@ -410,10 +451,10 @@
'./gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:DCP/srv:DCPList/@codeList',
"./resources/codelist/gmxCodelists.xml#DCPList");
- //connectPoint **********************************
+ //connectPoint **********************************
$xmlBuilder->addValue($MD_Metadata,
'./gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:connectPoint/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
- "http://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?inspire=1&featuretype_id=".$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS");
+ $url);
//fill in operatesOn fields with datasetid if given
/*INSPIRE example: <srv:operatesOn xlink:href="http://image2000.jrc.it#image2000_1_nl2_multi"/>*/
@@ -464,7 +505,6 @@
//Check if anonymous user has rights to access this featuretype - if not ? which resource should be advertised? TODO
//initialize url to give back as point of access
$url = '';
- //$e = new mb_exception($serviceType);
switch ($serviceType) {
case "wfs":
$url = $mapbenderServiceUrl.$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS&VERSION=".$mbMeta['wfs_version'];
@@ -471,7 +511,7 @@
$protocol = "OGC:WFS-".$mbMeta['wfs_version']."-http-get-feature";
break;
case "ogcapifeatures":
- $url = "http://localhost/spatial-objects/".$mbMeta['wfs_id']."/collections/".$mbMeta['featuretype_name'];
+ $url = $ogcApiFeaturesUrl."/".$mbMeta['wfs_id']."/collections/".$mbMeta['featuretype_name'];
$protocol = "OGC:API:Features";
break;
}
Modified: trunk/mapbender/http/php/mod_getDownloadOptions.php
===================================================================
--- trunk/mapbender/http/php/mod_getDownloadOptions.php 2019-10-02 07:08:15 UTC (rev 10280)
+++ trunk/mapbender/http/php/mod_getDownloadOptions.php 2019-10-02 11:44:04 UTC (rev 10281)
@@ -261,11 +261,14 @@
if (isset($configObject) && isset($configObject->behind_rewrite) && $configObject->behind_rewrite == true) {
if (isset($configObject) && isset($configObject->datasource_url) && $configObject->datasource_url != "") {
$downloadOptions->{$idList[$i]}->option[$j]->accessClient = $configObject->datasource_url.$configObject->rewrite_path."/".$row['service_id']."/collections/".$row['resource_name'];//."/items?&f=html";
+ $downloadOptions->{$idList[$i]}->option[$j]->accessUrl = $configObject->datasource_url.$configObject->rewrite_path."/".$row['service_id']."/api";//."/items?&f=html";
} else {
$downloadOptions->{$idList[$i]}->option[$j]->accessClient = "http://".$_SERVER['HTTP_HOST']."/".$configObject->rewrite_path."/".$row['service_id']."/collections/".$row['resource_name'];//."/items?&f=html";
+ $downloadOptions->{$idList[$i]}->option[$j]->accessUrl = "http://".$_SERVER['HTTP_HOST']."/".$configObject->rewrite_path."/".$row['service_id']."/api";//."/items?&f=html";
}
} else {
$downloadOptions->{$idList[$i]}->option[$j]->accessClient = $webPath."php/mod_linkedDataProxy.php?wfsid=".$row['service_id']."&collection=".$row['resource_name'];
+ $downloadOptions->{$idList[$i]}->option[$j]->accessUrl = $webPath."php/mod_linkedDataProxy.php?wfsid=".$row['service_id']."&collections=api";
}
//$downloadOptions->{$idList[$i]}->option[$j]->accessClient = "https://www....";
$downloadOptions->{$idList[$i]}->title = $row['title'];
More information about the Mapbender_commits
mailing list