[Mapbender-commits] r9691 - in trunk/mapbender/http: classes geoportal/metadata_templates php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 21 04:43:28 PST 2017


Author: armin11
Date: 2017-02-21 04:43:28 -0800 (Tue, 21 Feb 2017)
New Revision: 9691

Added:
   trunk/mapbender/http/classes/class_owsMetadataUrl.php
   trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_1.x_metadataurl.xml
   trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_2.x_metadataurl.xml
   trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wms_1.x_metadataurl.xml
Modified:
   trunk/mapbender/http/php/wfs.php
Log:
Some further improvements for INSPIRE compatibility of WFS proxy. Further things have to be investigated!

Added: trunk/mapbender/http/classes/class_owsMetadataUrl.php
===================================================================
--- trunk/mapbender/http/classes/class_owsMetadataUrl.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_owsMetadataUrl.php	2017-02-21 12:43:28 UTC (rev 9691)
@@ -0,0 +1,199 @@
+<?php
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+class OwsMetadataUrl {
+	var $urlArray;
+        var $typeArray;
+	var $formatArray;
+
+//for wfs 1.x after LatLongBoundingBox
+//problem: different layouts for different wfs versions!
+/*<wfs:MetadataURL type="FGDC" format="text/xml">http:/... </wfs:MetadataURL>*/
+//wfs 1.1.0
+/*
+<xsd:complexType name="MetadataURLType">
+<xsd:simpleContent>
+<xsd:extension base="xsd:string">
+<xsd:attribute name="type" use="required">
+<xsd:simpleType>
+<xsd:restriction base="xsd:NMTOKEN">
+<xsd:enumeration value="TC211"/>
+<xsd:enumeration value="FGDC"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:attribute>
+<xsd:attribute name="format" use="required">
+<xsd:simpleType>
+<xsd:restriction base="xsd:NMTOKEN">
+© OGC 2002 – All rights reserved
+89<xsd:enumeration value="XML"/>
+<xsd:enumeration value="SGML"/>
+<xsd:enumeration value="TXT"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:attribute>
+</xsd:extension>
+</xsd:simpleContent>
+</xsd:complexType>
+*/
+//wfs 1.1.0
+/*
+<xsd:complexType name="MetadataURLType">
+<xsd:simpleContent>
+<xsd:extension base="xsd:string">
+<xsd:attribute name="type" use="required">
+<xsd:simpleType>
+<xsd:restriction base="xsd:NMTOKEN">
+<xsd:enumeration value="TC211"/>
+<xsd:enumeration value="FGDC"/>
+<xsd:enumeration value="19115"/>
+<xsd:enumeration value="19139"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:attribute>
+<xsd:attribute name="format" use="required">
+<xsd:simpleType>
+<xsd:restriction base="xsd:NMTOKEN">
+<xsd:enumeration value="text/xml"/>
+<xsd:enumeration value="text/html"/>
+<xsd:enumeration value="text/sgml"/>
+<xsd:enumeration value="txt/plain"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:attribute>
+</xsd:extension>
+</xsd:simpleContent>
+</xsd:complexType>
+*/
+//wfs 2.0.2
+/*<MetadataURL
+            xlink:href="http://www.ogccatservice.com/csw.cgi?service=CSW&version=2.0.0&request=GetRecords&constraintlanguage=CQL&recordid=urn:uuid:4ee8b2d3-9409-4a1d-b26b-6782e4fa3d59"/>*/
+/*
+   <xsd:complexType name="FeatureTypeType">
+      <xsd:sequence>
+         <xsd:element name="Name" type="xsd:QName"/>
+         <xsd:element ref="wfs:Title" minOccurs="0" maxOccurs="unbounded"/>
+         <xsd:element ref="wfs:Abstract" minOccurs="0" maxOccurs="unbounded"/>
+         <xsd:element ref="ows:Keywords" minOccurs="0" maxOccurs="unbounded"/>
+         <xsd:choice>
+            <xsd:sequence>
+               <xsd:element name="DefaultCRS" type="xsd:anyURI"/>
+               <xsd:element name="OtherCRS" type="xsd:anyURI"
+                            minOccurs="0" maxOccurs="unbounded"/>
+            </xsd:sequence>
+            <xsd:element name="NoCRS">
+               <xsd:complexType/>
+            </xsd:element>
+         </xsd:choice>
+         <xsd:element name="OutputFormats" type="wfs:OutputFormatListType"
+                      minOccurs="0"/>
+         <xsd:element ref="ows:WGS84BoundingBox"
+                      minOccurs="0" maxOccurs="unbounded"/>
+         <xsd:element name="MetadataURL" type="wfs:MetadataURLType"
+                      minOccurs="0" maxOccurs="unbounded"/>
+         <xsd:element name="ExtendedDescription"
+                      type="wfs:ExtendedDescriptionType" minOccurs="0"/>
+      </xsd:sequence>
+   </xsd:complexType>
+   <xsd:complexType name="OutputFormatListType">
+      <xsd:sequence maxOccurs="unbounded">
+         <xsd:element name="Format" type="xsd:string"/>
+      </xsd:sequence>
+   </xsd:complexType>
+   <xsd:complexType name="MetadataURLType">
+      <xsd:attributeGroup ref="xlink:simpleLink"/>
+      <xsd:attribute name="about" type="xsd:anyURI"/>
+   </xsd:complexType>
+*/
+
+	public function __construct () {
+		
+	}
+
+	public function getOwsRepresentation($urlArray, $typeArray, $formatArray, $service = 'wfs', $version = '1.1.0') {
+		$this->urlArray = $urlArray;
+		$this->typeArray = $typeArray;
+		$this->formatArray = $formatArray;
+		//load xml snippet from filesystem as template
+		$metadataUrlDomObject = new DOMDocument();
+		switch ($service) {
+			case 'wfs':
+				switch ($version) {
+					case "1.1.0":
+						$template = "mb_ows_wfs_1.x_metadataurl.xml";
+						break;
+					case "1.0.0":
+						$template = "mb_ows_wfs_1.x_metadataurl.xml";
+						break;
+					case "2.0.0":
+						$template = "mb_ows_wfs_2.x_metadataurl.xml";
+						break;
+					case "2.0.2":
+						$template = "mb_ows_wfs_2.x_metadataurl.xml";
+						break;
+				}
+				break;
+			case 'wms':
+				$template = "mb_ows_metadataurl.xml";
+				break;
+		}
+		//$metadataUrlDomObject->load(dirname(__FILE__) . "/../geoportal/metadata_templates/mb_ows_metadataurl.xml");
+		$metadataUrlDomObject->load(dirname(__FILE__) . "/../geoportal/metadata_templates/".$template);
+		$xpathMetadataUrl = new DOMXpath($metadataUrlDomObject);
+		//$reportNodeList = $xpathLicense->query('/mb:dataqualityreport/gmd:report');
+		$xpathMetadataUrl->registerNamespace("mb", "http://www.mapbender.org/ows/metadataurl");
+		$xpathMetadataUrl->registerNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+		$xpathMetadataUrl->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
+		//clone report node and get parent
+		$MetadataUrl = $xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0);
+		$parent = $MetadataUrl->parentNode;
+		//add one entry foreach found element
+		$i = 0;
+		foreach ($this->urlArray as $url) {
+			//TODO: For wms:
+			//$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("type", $this->typeArray[$i]);
+			//$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL/Format')->item(0)->nodeValue = $this->formatArray[$i];
+			//$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL/OnlineResource')->item(0)->setAttribute("xlink:href", $url);
+			//For wfs 2.x
+			switch ($service) {
+				case 'wfs':
+					switch ($version) {
+						case "1.1.0":
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("type", $this->typeArray[$i]);
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("format", $this->formatArray[$i]);
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setValue = $this->urlArray[$i];
+							break;
+						case "1.0.0":
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("type", $this->typeArray[$i]);
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("format", $this->formatArray[$i]);
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setValue = $this->urlArray[$i];
+							break;
+						case "2.0.0":			
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("xlink:href", $url);
+							break;
+						case "2.0.2":
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
+							$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("xlink:href", $url);
+							break;
+					}
+					break;
+				case 'wms':
+					$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL')->item(0)->setAttribute("type", $this->typeArray[$i]);
+					$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL/Format')->item(0)->setValue = $this->formatArray[$i];
+					$xpathMetadataUrl->query('/mb:metadataurl/MetadataURL/OnlineResource')->item(0)->setAttribute("xlink:href", $url);
+					break;
+			}
+			//clone node and add if afterwards
+			$MetadataUrlNew = $MetadataUrl->cloneNode(true);
+			$parent->appendChild($MetadataUrlNew);
+			$i++;
+		}
+		//delete first (template) entry
+		$parent->removeChild($MetadataUrl);
+		$XML = $metadataUrlDomObject->saveXML();
+	 	return $XML;
+	}
+}
+
+?>

Added: trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_1.x_metadataurl.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_1.x_metadataurl.xml	                        (rev 0)
+++ trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_1.x_metadataurl.xml	2017-02-21 12:43:28 UTC (rev 9691)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mb:metadataurl xmlns:mb="http://www.mapbender.org/ows/metadataurl" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco">
+  <MetadataURL type="FDGC" format="text/xml">http://www.geoportal.rlp.de</MetadataURL>
+</mb:metadataurl>

Added: trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_2.x_metadataurl.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_2.x_metadataurl.xml	                        (rev 0)
+++ trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wfs_2.x_metadataurl.xml	2017-02-21 12:43:28 UTC (rev 9691)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mb:metadataurl xmlns:mb="http://www.mapbender.org/ows/metadataurl" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco">
+  <MetadataURL xlink:href="http://www.geoportal.rlp.de"/>
+</mb:metadataurl>

Added: trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wms_1.x_metadataurl.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wms_1.x_metadataurl.xml	                        (rev 0)
+++ trunk/mapbender/http/geoportal/metadata_templates/mb_ows_wms_1.x_metadataurl.xml	2017-02-21 12:43:28 UTC (rev 9691)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mb:metadataurl xmlns:mb="http://www.mapbender.org/ows/metadataurl" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco">
+  <MetadataURL type="ISO19115:2003">
+    <Format>text/xml</Format>
+    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.geoportal.rlp.de" xlink:type="simple"/>
+  </MetadataURL>
+</mb:metadataurl>

Modified: trunk/mapbender/http/php/wfs.php
===================================================================
--- trunk/mapbender/http/php/wfs.php	2017-02-21 07:34:26 UTC (rev 9690)
+++ trunk/mapbender/http/php/wfs.php	2017-02-21 12:43:28 UTC (rev 9691)
@@ -20,6 +20,7 @@
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_layer_monitor.php");
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__) . "/../classes/class_owsMetadataUrl.php");
 //
 $admin = new administration();
 //
@@ -152,7 +153,6 @@
 	$resourceMetadata['featuretype_geomType'] = $featuretypeElements['element_type'];
 }
 
-
 //
 // check if update sequence is valid
 //
@@ -195,7 +195,7 @@
 $doc->loadXML($xml_row["doc"]);
 $xpath = new DOMXPath($doc);
 
-if(strpos($version, '2.0') === 0) {
+if(strpos($version, '2.0') !== false) {
     $xpath->registerNamespace("wfs", "http://www.opengis.net/wfs/2.0");
 } else {
     $xpath->registerNamespace("wfs", "http://www.opengis.net/wfs");
@@ -211,14 +211,12 @@
 if ($elements->length >= 1) {
 	$element = $elements->item(0);
 	$element->setAttribute("updateSequence", $wfs_row["wfs_timestamp"]);
-	
 	if ($inspire){
 		$element->setAttribute("xmlns:inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
-		$element->setAttribute("xmlns:inspire_vs", "http://inspire.ec.europa.eu/schemas/inspire_vs/1.0");
+		$element->setAttribute("xmlns:inspire_dls", "http://inspire.ec.europa.eu/schemas/inspire_dls/1.0");
 	}
 }
 
-
 //delete all unrequested featuretypes from capabilities
 $featureTypeList = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType');//as domnodelist
 
@@ -227,12 +225,11 @@
         $temp = $featureTypeList->item($i);
 	$childs = $temp->childNodes;
 	foreach($childs as $child) {
-		if ($child->nodeName == "Name") {
-			$e = new mb_exception($child->nodeValue);
-			if ($child->nodeValue !== $xml_row["fname"]) {
-			    $child->parentNode->parentNode->removeChild($temp);
-			}
-		}
+	    if ($child->nodeName == "Name") {
+	        if ($child->nodeValue !== $xml_row["fname"]) {
+	            $child->parentNode->parentNode->removeChild($temp);
+	        }
+	    }
 	}
     }
 }
@@ -272,15 +269,14 @@
 			$wfs_row['wfs_getfeature'] = $tmpOR;
 			$wfs_row['wfs_transaction'] = $tmpOR;
 		}
+	} else {
+	    //use owsproxy url
+	    $tmpOR = $urlPrefix.$_SERVER["HTTP_HOST"]."/owsproxy/".$sessionId."/".$wfs_row["wfs_owsproxy"]."?";
+	    $tmpOR = str_replace(SERVERIP, SERVERNAME, $tmpOR);
+	    $wfs_row['wfs_describefeaturetype'] = $tmpOR;
+	    $wfs_row['wfs_getfeature'] = $tmpOR;
+	    $wfs_row['wfs_transaction'] = $tmpOR;
 	}
-	else {
-		//use owsproxy url
-		$tmpOR = $urlPrefix.$_SERVER["HTTP_HOST"]."/owsproxy/".$sessionId."/".$wfs_row["wfs_owsproxy"]."?";
-		$tmpOR = str_replace(SERVERIP, SERVERNAME, $tmpOR);
-		$wfs_row['wfs_describefeaturetype'] = $tmpOR;
-		$wfs_row['wfs_getfeature'] = $tmpOR;
-		$wfs_row['wfs_transaction'] = $tmpOR;
-	}
 }
 
 $elements = $xpath->query('//ows:OnlineResource');
@@ -325,7 +321,126 @@
 	$element->setAttribute("xlink:href", $wfs_row['wfs_getfeature']);
 }
 
+//Add MetadataUrl entries from mapbender database
+//Creating Metadata nodes
+//read out all metadata entries for specific featuretype
+$sql = <<<SQL
 
+SELECT metadata_id, uuid, link, linktype, md_format, origin, datasetid, md_proxy FROM mb_metadata 
+INNER JOIN (SELECT * from ows_relation_metadata 
+WHERE fkey_featuretype_id = $featuretypeId ) as relation ON 
+mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin IN ('capabilities','external','metador','upload')
+
+SQL;
+$res_metadata = db_query($sql);
+$metadataUrl = array();
+$linkType = array();
+$format = array();
+$datasetId = array();
+//
+$k = 0;
+while ($row_metadata = db_fetch_array($res_metadata)) {
+	if ($row_metadata["datasetid"] == '' || !isset($row_metadata["datasetid"])) {
+		//this column is empty, if metador was used and the identifier for dataset id is equal to the identifier of the metadata fileidentifier. In this case we expand a standard codespace http://www.geoportal.rlp.de 
+		if (defined('METADATA_DEFAULT_CODESPACE')) {
+			$datasetId[$k] = METADATA_DEFAULT_CODESPACE."#".$row_metadata["uuid"];
+		} else {
+			if (defined("METADATA_DEFAULT_CODESPACE") && METADATA_DEFAULT_CODESPACE != '') {
+				$datasetId[$k] = METADATA_DEFAULT_CODESPACE."#".$row_metadata["uuid"];
+			} else {
+				$datasetId[$k] = "http://www.mapbender.org"."#".$row_metadata["uuid"];
+			}
+		}
+	} else {
+		$datasetId[$k] = $row_metadata["datasetid"]; //really datasetid or only second part?
+	}
+	//push entries into xml structure	
+	//check for kind of link - push the right one into the link field	
+	switch ($row_metadata['origin']) {
+		case 'capabilities':
+			//check if md_proxy is set
+			if ($row_metadata['md_proxy'] == 't' || $row_metadata['md_proxy'] == true) {
+				$metadataUrl[$k] = $mapbenderMetadataUrlUrl.$row_metadata['uuid'];
+			} else {
+				$metadataUrl[$k] = $row_metadata['link'];
+			}
+			$linkType[$k] = $row_metadata['linktype'];
+			$format[$k] = $row_metadata['md_format'];
+		break;
+		case 'external':
+			//check if md_proxy is set
+			if ($row_metadata['md_proxy'] == 't' || $row_metadata['md_proxy'] == true) {
+				$metadataUrl[$k] = $mapbenderMetadataUrlUrl.$row_metadata['uuid'];
+			} else {
+				$metadataUrl[$k] = $row_metadata['link'];
+			}
+			$linkType[$k] = 'ISO19115:2003';
+			$format[$k] = "text/xml";
+		break;
+		case 'upload':
+			$metadataUrl[$k] = $mapbenderMetadataUrlUrl.$row_metadata['uuid'];
+			$linkType[$k] = 'ISO19115:2003';
+			$format[$k] = "text/xml";
+		break;
+		case 'metador':
+			$metadataUrl[$k] = $mapbenderMetadataUrlUrl.$row_metadata['uuid'];
+			$linkType[$k] = 'ISO19115:2003';
+			$format[$k] = "text/xml";
+		break;
+		default:
+			$metadataUrl[$k] = "Url not given - please check your registry!";
+			$linkType[$k] = 'ISO19115:2003';
+			$format[$k] = "text/xml";
+		break;
+	}
+	//Add linkage to Capabilities
+	$k++;
+}
+$k = 0;
+if (is_array($metadataUrl) && count($metadataUrl) > 0) {
+	$metadataUrlObject = new OwsMetadataUrl();
+	//$e = new mb_exception('version: '.$version);
+	$metadata_part = $metadataUrlObject->getOwsRepresentation($metadataUrl, $linkType, $format, 'wfs', $version);
+	//$e = new mb_exception($metadata_part);
+}
+
+//insert metadata url elements into capabilities - either delete existing entries and recreate them or put them after ows:WGS84BoundingBox (WFS 2.0), wfs .....
+//test for existing MetadataURL entries
+if ($featuretypeId) {
+	$metadataUrls = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/MetadataURL');
+	$wgs84bboxs = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/ows:WGS84BoundingBox');
+	if ($metadataUrls->length > 0) {
+		if (isset($metadata_part) && $metadata_part !== '') {
+			//load xml from constraint generator
+			$metadataUrlDomObject = new DOMDocument();
+			$metadataUrlDomObject->loadXML($metadata_part);
+			$xpathMetadataUrl = new DOMXpath($metadataUrlDomObject);
+			$metadataUrlNodeList = $xpathMetadataUrl->query('/mb:metadataurl/MetadataURL');
+			//insert new MetadataURL entries before first old node
+			for ($i = ($metadataUrlNodeList->length)-1; $i >= 0; $i--) {
+				$metadataUrls->item(0)->parentNode->insertBefore($doc->importNode($metadataUrlNodeList->item($i), true), $metadataUrls->item(0));
+			}
+			//delete all old entries from original xml document 
+			for ($i = 0; $i <  $metadataUrls->length; $i++) {
+    					$temp = $metadataUrls->item($i); //avoid calling a function twice
+    					$temp->parentNode->removeChild($temp);
+			}
+		}
+	} else {
+		if (isset($metadata_part) && $metadata_part !== '') {
+			//load xml from constraint generator
+			$metadataUrlDomObject = new DOMDocument();
+			$metadataUrlDomObject->loadXML($metadata_part);
+			$xpathMetadataUrl = new DOMXpath($metadataUrlDomObject);
+			$metadataUrlNodeList = $xpathMetadataUrl->query('/mb:metadataurl/MetadataURL');
+			//insert new MetadataURL entries after ows:WGS84BoundingBox for wfs 2.0.x
+			for ($i = ($metadataUrlNodeList->length)-1; $i >= 0; $i--) {
+				$wgs84bboxs->item(0)->parentNode->insertBefore($doc->importNode($metadataUrlNodeList->item($i), true), $wgs84bboxs->item(0)->nextSibling);
+			}
+		}
+	}
+}
+
 ################################################################
 #INSPIRE
 if ($inspire) {
@@ -336,20 +451,20 @@
 	#generating the vendor specific node
 	$vendorSpecificCapabilities = $doc->createElement("VendorSpecificCapabilities");
 	$vendorSpecificCapabilities = $refNode->appendChild($vendorSpecificCapabilities);
-	#generate inspire_vs:ExtendedCapabilities node
-	$inspire_vs_ExtendedCapabilities = $doc->createElement("inspire_vs:ExtendedCapabilities");
-	$inspire_vs_ExtendedCapabilities->setAttribute("xmlns:inspire_vs", "http://inspire.ec.europa.eu/schemas/inspire_vs/1.0");
-	$inspire_vs_ExtendedCapabilities = $vendorSpecificCapabilities->appendChild($inspire_vs_ExtendedCapabilities);
-	#generate inspire_vs: node
-	#$inspire_vs_ExtendedCapabilities = $doc->createElement("inspire_vs:ExtendedCapabilities");
-	#$inspire_vs_ExtendedCapabilities = $vendorSpecificCapabilities->appendChild($inspire_vs_ExtendedCapabilities);
+	#generate inspire_dls:ExtendedCapabilities node
+	$inspire_dls_ExtendedCapabilities = $doc->createElement("inspire_dls:ExtendedCapabilities");
+	$inspire_dls_ExtendedCapabilities->setAttribute("xmlns:inspire_dls", "http://inspire.ec.europa.eu/schemas/inspire_dls/1.0");
+	$inspire_dls_ExtendedCapabilities = $vendorSpecificCapabilities->appendChild($inspire_dls_ExtendedCapabilities);
+	#generate inspire_dls: node
+	#$inspire_dls_ExtendedCapabilities = $doc->createElement("inspire_dls:ExtendedCapabilities");
+	#$inspire_dls_ExtendedCapabilities = $vendorSpecificCapabilities->appendChild($inspire_dls_ExtendedCapabilities);
 	#MetadataUrl to inspire service metadata
 	$inspire_common_MetadataUrl = $doc->createElement("inspire_common:MetadataUrl");
 	/*<inspire_common:MetadataUrl xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="inspire_common:resourceLocatorType">*/
 	$inspire_common_MetadataUrl->setAttribute("xmlns:inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
 	$inspire_common_MetadataUrl->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
 	$inspire_common_MetadataUrl->setAttribute("xsi:type", "inspire_common:resourceLocatorType");
-	$inspire_common_MetadataUrl = $inspire_vs_ExtendedCapabilities->appendChild($inspire_common_MetadataUrl);
+	$inspire_common_MetadataUrl = $inspire_dls_ExtendedCapabilities->appendChild($inspire_common_MetadataUrl);
 	#URL
 	$inspire_common_URL = $doc->createElement("inspire_common:URL");
 	$inspire_common_URL->setAttribute("xmlns:inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
@@ -360,13 +475,13 @@
 	#MediaType
 	$inspire_common_MediaType = $doc->createElement("inspire_common:MediaType");
 	$inspire_common_MediaType->setAttribute("xmlns:inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
-	$inspire_common_MediaTypeText = $doc->createTextNode('application/vnd.iso.19139+xml');#from http://inspire.ec.europa.eu/schemas/inspire_vs/1.0/examples/WMS_Image2000GetCapabilities_InspireSchema.xml
+	$inspire_common_MediaTypeText = $doc->createTextNode('application/vnd.iso.19139+xml');#from http://inspire.ec.europa.eu/schemas/inspire_dls/1.0/examples/WMS_Image2000GetCapabilities_InspireSchema.xml
 	$inspire_common_MediaType->appendChild($inspire_common_MediaTypeText);
 	$inspire_common_MediaType = $inspire_common_MetadataUrl->appendChild($inspire_common_MediaType);
 	#Language Part
 	#SupportedLanguages
 	$inspire_common_SupportedLanguages = $doc->createElement("inspire_common:SupportedLanguages");
-	$inspire_common_SupportedLanguages = $inspire_vs_ExtendedCapabilities->appendChild($inspire_common_SupportedLanguages);
+	$inspire_common_SupportedLanguages = $inspire_dls_ExtendedCapabilities->appendChild($inspire_common_SupportedLanguages);
 	#DefaultLanguage
 	$inspire_common_DefaultLanguage = $doc->createElement("inspire_common:DefaultLanguage");
 	$inspire_common_DefaultLanguage = $inspire_common_SupportedLanguages->appendChild($inspire_common_DefaultLanguage);
@@ -385,12 +500,47 @@
 	$inspire_common_Language = $inspire_common_SupportedLanguage->appendChild($inspire_common_Language);
 	#ResponseLanguage
 	$inspire_common_ResponseLanguage = $doc->createElement("inspire_common:ResponseLanguage");
-	$inspire_common_ResponseLanguage = $inspire_vs_ExtendedCapabilities->appendChild($inspire_common_ResponseLanguage);
+	$inspire_common_ResponseLanguage = $inspire_dls_ExtendedCapabilities->appendChild($inspire_common_ResponseLanguage);
 	#Language
 	$inspire_common_Language = $doc->createElement("inspire_common:Language");
 	$inspire_common_LanguageText = $doc->createTextNode('ger');
 	$inspire_common_Language->appendChild($inspire_common_LanguageText);
 	$inspire_common_Language = $inspire_common_ResponseLanguage->appendChild($inspire_common_Language);
+	# add indentifier foreach existing metadata url entry - see above!
+	/*
+<ows:ExtendedCapabilities>
+<inspire_dls:ExtendedCapabilities>
+<!-- Dienste Metadaten -->
+<!-- Sprachen -->
+<!-- SpatialDatasetIdentifier -->
+<inspire_dls:SpatialDataSetIdentifier>
+<inspire_common:Code>DEBY_eea97fc0-b6bf-11e1-afa6-
+0800200c9a66</inspire_common:Code>
+<inspire_common:Namespace>http://www.geodaten.bayern.de</inspire_common:Namespac
+e>
+</inspire_dls:SpatialDataSetIdentifier>
+</inspire_dls:ExtendedCapabilities>
+</ows:ExtendedCapabilities>
+	*/
+	foreach ($datasetId as $singleDatasetId) {
+		//$e = new mb_exception("datasetid: ".$singleDatasetId);
+		//try to explode with # or / afterwards
+		if (strpos($singleDatasetId, '#') !== false && count(explode('#', $singleDatasetId) == 2) ) {
+			//$e = new mb_exception("found inspire dataset id");
+			//build id part
+			$inspire_dls_SpatialDataSetIdentifier = $doc->createElement("inspire_dls:SpatialDataSetIdentifier");
+			$inspire_common_Code = $doc->createElement("inspire_common:Code");
+			$inspire_common_Namespace = $doc->createElement("inspire_common:Namespace");
+			$inspire_common_CodeText = $doc->createTextNode(explode('#', $singleDatasetId)[1]);
+			$inspire_common_NamespaceText = $doc->createTextNode(explode('#', $singleDatasetId)[0]);
+			$inspire_common_Namespace->appendChild($inspire_common_NamespaceText);
+			$inspire_common_Code->appendChild($inspire_common_CodeText);
+			$inspire_dls_SpatialDataSetIdentifier->appendChild($inspire_common_Code);
+			$inspire_dls_SpatialDataSetIdentifier->appendChild($inspire_common_Namespace);
+			$inspire_dls_ExtendedCapabilities->appendChild($inspire_dls_SpatialDataSetIdentifier);
+		}
+	}
+
 }
 
 header("Content-type: application/xhtml+xml; charset=UTF-8");



More information about the Mapbender_commits mailing list