[Mapbender-commits] r10043 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 31 08:08:12 PST 2019


Author: armin11
Date: 2019-01-31 08:08:12 -0800 (Thu, 31 Jan 2019)
New Revision: 10043

Modified:
   trunk/mapbender/http/php/mod_callCswMetadata.php
Log:
Add wms accessurl and atomfeed client invocation url to json files from csw proxy

Modified: trunk/mapbender/http/php/mod_callCswMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callCswMetadata.php	2019-01-31 15:03:07 UTC (rev 10042)
+++ trunk/mapbender/http/php/mod_callCswMetadata.php	2019-01-31 16:08:12 UTC (rev 10043)
@@ -802,13 +802,12 @@
 		$parsingMetadataStartTime = microtime_float();
 
 		for ($k = 1; $k <= count($metadataRecord) ; $k++) {
-			
 			$fileIdentifier = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:fileIdentifier/gco:CharacterString');
 			$fileIdentifier = (string)$fileIdentifier[0];
-$resultObject->{$searchResource}->srv[$k-1]->id = $fileIdentifier;
+			$resultObject->{$searchResource}->srv[$k-1]->id = $fileIdentifier;
 			$mdDateStamp = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:dateStamp/gco:Date');
 			$mdDateStamp = (string)$mdDateStamp[0];
-$resultObject->{$searchResource}->srv[$k-1]->date = $mdDateStamp;
+			$resultObject->{$searchResource}->srv[$k-1]->date = $mdDateStamp;
 			switch ($searchResource) {
 				case "service": 
 					$identifikationXPath = "srv:SV_ServiceIdentification";
@@ -828,8 +827,7 @@
 				$previewImage = null;
 			}
 
-$resultObject->{$searchResource}->srv[$k-1]->previewUrl = $previewImage;
-
+			$resultObject->{$searchResource}->srv[$k-1]->previewUrl = $previewImage;
 			//organization name
 			$resourceResponsibleParty = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:identificationInfo/'.$identifikationXPath.'/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString');
 			$resourceResponsibleParty = $resourceResponsibleParty[0];
@@ -848,12 +846,64 @@
 			if (isset($csw->cat_op_values['getrecordbyid']['get'])) {
 				$resultObject->{$searchResource}->srv[$k-1]->mdLink = $csw->cat_op_values['getrecordbyid']['get']."?request=GetRecordById&service=CSW&version=2.0.2&Id=".$fileIdentifier."&ElementSetName=full&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd";
 			}
-			//html view
-			if ($_SERVER['HTTPS'] !== '') {
+			//service type
+			$typeOfService = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:serviceType/gco:LocalName');
+			$typeOfService = $typeOfService[0];
+			//service type version
+			$typeOfServiceVersion = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:serviceTypeVersion/gco:CharacterString');
+			$typeOfServiceVersion = $typeOfServiceVersion[0]; //predefined ATOM, ...
+			//service access url
+			//first read the inspire kind of implementation of the access to capabilities documents
+			$accessUrl = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL');
+$e = new mb_exception("accessUrl: ".$accessUrl[0]);
+			if ($accessUrl[0] == '') {
+				//search for another accessUrl - as defined in csw ap iso
+				$accessUrl = $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:connectPoint/gmd:CI_OnlineResource/gmd:linkage/gmd:URL');
+			}
+			$accessUrl = $accessUrl[0];
+			$isViewService = false;	
+			$isDownloadService = false;
+			$typeOfServiceUpper = strtoupper($typeOfService);
+			//check for view service type
+			if ($typeOfServiceUpper == 'WMS' || $typeOfServiceUpper == 'VIEW'  || strpos($typeOfServiceUpper,'WMS') !== false) {
+				$isViewService = true;	
+				//echo "view service identified<br>";
+			}
+
+
+			if ($typeOfServiceUpper == 'DOWNLOAD' || $typeOfServiceUpper == 'ATOM'  || strpos($typeOfServiceUpper,'PREDEFINED ATOM') !== false) {
+				$isDownloadService = true;	
+				//echo "view service identified<br>";
+			}
+			//check if service is view or wms and correct it for wms 1.1.1 capabilities request
+			if ($searchResource == 'service' && $isViewService) {
+				if ($accessUrl != '') {
+					$accessUrl = correctWmsUrl($accessUrl);
+				} else {
+					$accessUrl = '';
+				}
+			} else {
+				//echo "<b>no</b> view service identified<br>";
+				$isViewService = false;
+			}
+			if ($isViewService == true) {
+				/*switch ($typeOfService) {
+					case "":
+						break;
+					case "":
+						break;
+				}*/
+				$resultObject->{$searchResource}->srv[$k-1]->showMapUrl = $accessUrl;
+			}
+			if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
 				$scheme = "https";
 			} else {
 				$scheme = "http";
 			}
+			if ($isDownloadService == true && strtoupper($typeOfServiceVersion) == 'PREDEFINED ATOM' ) {
+				$resultObject->{$searchResource}->srv[$k-1]->downloadFeedClientUrl = $scheme.'://'.$_SERVER['HTTP_HOST'].str_replace("php/".basename($_SERVER['SCRIPT_NAME']), "plugins/mb_downloadFeedClient.php", $_SERVER['PHP_SELF'])."?url=".urlencode($accessUrl);
+			}
+			//html view
 			$resultObject->{$searchResource}->srv[$k-1]->htmlLink = $scheme.'://'.$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']), "mod_exportIso19139.php", $_SERVER['PHP_SELF'])."?url=".urlencode($resultObject->{$searchResource}->srv[$k-1]->mdLink);
 			//service urls if available 
 			//type of service



More information about the Mapbender_commits mailing list