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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 6 03:18:27 PDT 2013


Author: armin11
Date: 2013-05-06 03:18:27 -0700 (Mon, 06 May 2013)
New Revision: 8615

Modified:
   trunk/mapbender/http/php/mod_exportISOMetadata.php
   trunk/mapbender/http/php/mod_inspireDownloadFeed.php
Log:
Some bugfixes for INSPIRE Proxy - thanx to Stefan Wannemacher.

Modified: trunk/mapbender/http/php/mod_exportISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_exportISOMetadata.php	2013-05-06 09:24:34 UTC (rev 8614)
+++ trunk/mapbender/http/php/mod_exportISOMetadata.php	2013-05-06 10:18:27 UTC (rev 8615)
@@ -101,28 +101,31 @@
 	//get all connected metadata for this layer and save it too	
 	$sql = <<<SQL
 
-SELECT metadata_id, uuid, link, linktype, md_format, origin FROM mb_metadata 
+SELECT metadata_id, uuid, link, linktype, md_format, origin, export2csw FROM mb_metadata 
 INNER JOIN (SELECT * from ows_relation_metadata 
 WHERE fkey_layer_id = $layerId ) as relation ON 
-mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.export2csw = TRUE
+mb_metadata.metadata_id = relation.fkey_metadata_id
 
 SQL;
 	
 	$res_metadata = db_query($sql);
 	while ($row_metadata = db_fetch_array($res_metadata)) {
-		$generatorUrlMetadata = $generatorBaseUrlMetadata."outputFormat=iso19139&id=".$row_metadata['uuid'];
-		echo "<BLOCKQUOTE>URL requested : ".$generatorUrlMetadata."<br>";
-		$generatorInterfaceObject = new connector($generatorUrlMetadata);
-		$ISOFile = $generatorInterfaceObject->file;
-		echo "Metadata uuid: ".$row_metadata['uuid']."<br>";
-		//generate temporary files under tmp
-		if($h = fopen(METADATA_DIR."/mapbenderDataMetadata_".$layerId."_".$row_metadata['uuid']."_iso19139.xml","w")){
-			if(!fwrite($h,$ISOFile)){
-				$e = new mb_exception("mod_exportISOMetadata.php: cannot write to file: ".METADATA_DIR."/metadata/mapbenderMetadata_".$layerId."_".$row_metadata['uuid']."_iso19139.xml");
+		//export only metadata which should be exported to the external csw interface
+		if ($row_metadata["export2csw"] == "t") {
+			$generatorUrlMetadata = $generatorBaseUrlMetadata."outputFormat=iso19139&id=".$row_metadata['uuid'];
+			echo "<BLOCKQUOTE>URL requested : ".$generatorUrlMetadata."<br>";
+			$generatorInterfaceObject = new connector($generatorUrlMetadata);
+			$ISOFile = $generatorInterfaceObject->file;
+			echo "Metadata uuid: ".$row_metadata['uuid']."<br>";
+			//generate temporary files under tmp
+			if($h = fopen(METADATA_DIR."/mapbenderDataMetadata_".$layerId."_".$row_metadata['uuid']."_iso19139.xml","w")){
+				if(!fwrite($h,$ISOFile)){
+					$e = new mb_exception("mod_exportISOMetadata.php: cannot write to file: ".METADATA_DIR."/metadata/mapbenderMetadata_".$layerId."_".$row_metadata['uuid']."_iso19139.xml");
+				}
+				echo "Data metadate file for layer ".$row['layer_id']." and metadata ".$row_metadata['uuid']." written to ".METADATA_DIR."</BLOCKQUOTE><br>";
+				fclose($h);
+				$countMetadataURL++;	
 			}
-			echo "Data metadate file for layer ".$row['layer_id']." and metadata ".$row_metadata['uuid']." written to ".METADATA_DIR."</BLOCKQUOTE><br>";
-			fclose($h);
-			$countMetadataURL++;	
 		}
 		//generate the downloadservice metadata files thru walking over the coupled dls for this metadata uuid!
 		//e.g. http://www.geoportal.rlp.de/mapbender/php/mod_inspireAtomFeedISOMetadata.php?Id=1487b57f-f087-d84a-3de3-e341312ecd6e&outputFormat=iso19139&generateFrom=wfs&wfsid=271

Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-05-06 09:24:34 UTC (rev 8614)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-05-06 10:18:27 UTC (rev 8615)
@@ -405,13 +405,21 @@
 		return "<error>For the metadataset with id ".$mapbenderMetadata[$m]->metadata_id." is no reference system defined!</error>";
 	}
 	
-	//Handle CRS
+	//Handle CRS - maybe in 'urn:ogc:def:crs:EPSG:6.9:4326' or 'EPSG:4326' or 'epsg:4326' or 'urn:ogc:def:crs:EPSG::4326' format!
+	//TODO test this also in sqls from mapbenders database - see wms 1.3.0 - for layer metadata
+	//explode strings
 	//alter all to uppercase 
 	$crsUpper = str_replace("epsg","EPSG",$crs);
-	//Exchange :: with :
-	$crsUpper = str_replace("::",":",$crsUpper);
-	$epsgId = explode('EPSG:',$crsUpper);
-	$epsgId = end($epsgId);
+	//explode strings
+	$crsUpperArray = explode($crsUpper);
+	switch (count($crsUpperArray)) {
+		case 7:
+			$epsgId = $crsUpperArray[6];
+		break;
+		case 2:
+			$epsgId = $crsUpperArray[1];
+		break;	
+	}
 	//check if order have to be altered
 	if (strpos($crsUpper,'urn') !== false) {
 		//check if axis order should be changed 



More information about the Mapbender_commits mailing list