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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 8 07:09:35 PDT 2018


Author: armin11
Date: 2018-08-08 07:09:34 -0700 (Wed, 08 Aug 2018)
New Revision: 9934

Modified:
   trunk/mapbender/http/php/mod_inspireDownloadFeed.php
Log:
Fix inspire atom feed generator for describedby references in dataset feeds - TBD: reference inspire registry if conformant data is provided!

Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2018-08-08 09:53:04 UTC (rev 9933)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2018-08-08 14:09:34 UTC (rev 9934)
@@ -818,6 +818,17 @@
 		break;
 		case "wfs":
 			$atomFeedKey .= $wfsId;
+			switch ($mapbenderMetadata[$m]->wfs_version) {
+				case "2.0.2":
+					$typeParameterName = "typeNames";
+					break;
+				case "2.0.0":
+					$typeParameterName = "typeNames";
+					break;
+				default:
+					$typeParameterName = "typeName";
+					break;
+			}
 		break;
 	}
 	//$e = new mb_exception("mod_inspireDownloadFeed.php: cachedVariableTimestamp: ".date("Y-m-d H:i:s",$cache->cachedVariableCreationTime($atomFeedKey)));
@@ -915,17 +926,42 @@
 		} else {
 			$feedLink->setAttribute("href", $mapbenderPath."php/mod_inspireAtomFeedISOMetadata.php?id=".$recordId."&outputFormat=iso19139&generateFrom=".$generateFrom."&layerid=".$layerId);
 		}
-		
-		
+		$feedLink->setAttribute("rel", "describedby");
+		$feedLink->setAttribute("type", "application/xml");
+		$feed->appendChild($feedLink);
 	} else { //DATASET
-		$feedLink->setAttribute("href", $mapbenderPath."php/mod_dataISOMetadata.php?id=".$mapbenderMetadata[$m]->metadata_uuid."&outputFormat=iso19139");
+		switch ($generateFrom) {
+			//TODO: set inspire data model reference if conformity is declared and theme is given!
+			case "wfs":
+				if ($admin->getWFSOWSstring($mapbenderMetadata[$m]->wfs_id) == false) {
+					$feedLink->setAttribute("href", $mapbenderMetadata[$m]->wfs_describefeaturetype."SERVICE=WFS&VERSION=".$mapbenderMetadata[$m]->wfs_version."&REQUEST=DescribeFeaturetype&".$typeParameterName."=".$mapbenderMetadata[$m]->featuretype_name);
+				} else {
+					$feedLink->setAttribute("href", $mapbenderServerUrl."/registry/wfs/".$mapbenderMetadata[$m]->wfs_id."?INSPIRE=1&"."SERVICE=WFS&VERSION=".$mapbenderMetadata[$m]->wfs_version."&REQUEST=DescribeFeaturetype&".$typeParameterName."=".$mapbenderMetadata[$m]->featuretype_name);
+				}
+				$feedLink->setAttribute("rel", "describedby");
+				$feedLink->setAttribute("type", "application/xml");
+				$feed->appendChild($feedLink);
+				break;
+			case "wms":
+				$feedLink->setAttribute("href", "https://en.wikipedia.org/wiki/GeoTIFF");
+				$feedLink->setAttribute("rel", "describedby");
+				$feedLink->setAttribute("type", "text/html");
+				$feed->appendChild($feedLink);
+				break;
+			case "dataurl":
+				$feedLink->setAttribute("href", "https://www.google.com/search?q=".$mapbenderMetadata[$m]->format."+spatial");
+				$feedLink->setAttribute("rel", "describedby");
+				$feedLink->setAttribute("type", "text/html");
+				$feed->appendChild($feedLink);
+				break;
+			case "metadata":
+				$feedLink->setAttribute("href", "https://www.google.com/search?q=".$mapbenderMetadata[$m]->format."+spatial");
+				$feedLink->setAttribute("rel", "describedby");
+				$feedLink->setAttribute("type", "text/html");
+				$feed->appendChild($feedLink);
+				break;
+		}
 	}
-	$feedLink->setAttribute("rel", "describedby");
-	$feedLink->setAttribute("type", "application/xml");
-	//$feedLink->setAttribute("title", "Metadaten");
-	//$feedLink->setAttribute("hreflang", "de");
-	$feed->appendChild($feedLink);
-
 	//self reference - 5.1.4 / 5.2
 	if ($type == 'SERVICE') {
 		$selfReference = $mapbenderServerUrl.$_SERVER['SCRIPT_NAME']."?id=".$recordId."&type=SERVICE&generateFrom=".$generateFrom;
@@ -970,13 +1006,13 @@
 	} else { //5.2.2
 
 	//description of datatypes - if given??? What todo when there is no description available - some html page have to be referenced?
-		$feedLink = $feedDoc->createElement("link");
+		/*$feedLink = $feedDoc->createElement("link");
 		$feedLink->setAttribute("href", $mapbenderPath."php/mod_showMetadata.php?languageCode=de&resource=layer&layout=tabs&id=".$recordId); //TODO show metadata in form of html content - switch for each type
 		$feedLink->setAttribute("rel", "describedby");
 		$feedLink->setAttribute("type", "text/html");
 		$feedLink->setAttribute("hreflang", "de");
 		$feedLink->setAttribute("title", "Nähere Beschreibung des Datensatzes");
-		$feed->appendChild($feedLink);
+		$feed->appendChild($feedLink);*/
 	}
 	//5.1.6 - 5.1.7
 	//other -- not needed cause only one language is defined
@@ -1193,17 +1229,7 @@
 					//define request to get number of hits per featuretype
 					//add ? if not given in string
 					$gHLink = $mapbenderMetadata[$i]->wfs_getfeature."SERVICE=WFS&REQUEST=GetFeature&VERSION=";
-					switch ($mapbenderMetadata[$i]->wfs_version) {
-						case "2.0.0":
-							$gHLink .= $mapbenderMetadata[$i]->wfs_version."&typeNames=";
-							break;
-						case "2.0.2":
-							$gHLink .= $mapbenderMetadata[$i]->wfs_version."&typeNames=";
-							break;
-						default:
-							$gHLink .= $mapbenderMetadata[$i]->wfs_version."&typeName=";
-							break;
-					}
+					$gHLink .= $mapbenderMetadata[$i]->wfs_version."&".$typeParameterName."=";
 					$gHLink .= $mapbenderMetadata[$i]->featuretype_name."&resultType=hits";
 					$startRequestTime = time();
 					//get auth information from database:
@@ -1426,17 +1452,7 @@
 						$wfsGetFeatureUrl = $mapbenderServerUrl."/registry/wfs/".$mapbenderMetadata[$i]->wfs_id."?";
 					}
 					$gFLink = $wfsGetFeatureUrl."SERVICE=WFS&REQUEST=GetFeature&VERSION=";
-					switch ($mapbenderMetadata[$i]->wfs_version) {
-						case "2.0.0":
-							$gFLink .= $mapbenderMetadata[$i]->wfs_version."&typeNames=".$mapbenderMetadata[$i]->featuretype_name;
-							break;
-						case "2.0.2":
-							$gFLink .= $mapbenderMetadata[$i]->wfs_version."&typeNames=".$mapbenderMetadata[$i]->featuretype_name;
-							break;
-						default:
-							$gFLink .= $mapbenderMetadata[$i]->wfs_version."&typeName=".$mapbenderMetadata[$i]->featuretype_name;
-							break;
-					}
+					$gFLink .= $mapbenderMetadata[$i]->wfs_version."&".$typeParameterName."=".$mapbenderMetadata[$i]->featuretype_name;
 					$gFLink .= "&srsName=".$mapbenderMetadata[$i]->featuretype_srs;
 					//TODO check if other epsg string should be used!
 					//$crsObject->identifier;
@@ -2010,6 +2026,7 @@
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_abstract = $row['wfs_abstract'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_getfeature = $admin->checkUrl($row['wfs_getfeature']);
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_getcapabilities = $row['wfs_getcapabilities'];
+				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_describefeaturetype = $row['wfs_describefeaturetype'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_version = $row['wfs_version'];
 				$mapbenderMetadata[$indexMapbenderMetadata]->wfs_max_features = $row['wfs_max_features'];
 



More information about the Mapbender_commits mailing list