[Mapbender-commits] r8342 - in trunk/mapbender: http/classes http/php http/plugins resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 7 05:54:47 EDT 2012


Author: armin11
Date: 2012-05-07 02:54:47 -0700 (Mon, 07 May 2012)
New Revision: 8342

Modified:
   trunk/mapbender/http/classes/class_universal_wfs_factory.php
   trunk/mapbender/http/classes/class_wfsToDb.php
   trunk/mapbender/http/classes/class_wfs_1_0_factory.php
   trunk/mapbender/http/classes/class_wfs_1_1_factory.php
   trunk/mapbender/http/classes/class_wfs_factory.php
   trunk/mapbender/http/classes/class_wfs_featuretype.php
   trunk/mapbender/http/php/mod_dataISOMetadata.php
   trunk/mapbender/http/php/mod_loadwfs.php
   trunk/mapbender/http/plugins/mb_metadata_wfs_server.php
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
Log:
More work on the wfs metadata editor for inspire. The datamodel is extended to manage othersrs and latlonbboxes for wfs_featuretypes.

Modified: trunk/mapbender/http/classes/class_universal_wfs_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_wfs_factory.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_universal_wfs_factory.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -113,4 +113,4 @@
 		}
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_wfsToDb.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -164,7 +164,7 @@
 		);
 			
 		$t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s','s' ,'s','s','s','s','s','s','s','s','s','s','i','i','i','i');
-		$e = new mb_exception("UPDATING WFS " . $aWfs->id);
+		$e = new mb_notice("UPDATING WFS " . $aWfs->id);
 		$res = db_prep_query($sql, $v, $t);
 		if (!$res) {
 			$e = new mb_exception("Error while updating WFS in database.");
@@ -189,14 +189,14 @@
 			array_push($featureTypeNameArray, $currentFeatureType);
 			if (WfsToDb::featureTypeExists($currentFeatureType)) {
 				// update existing WFS feature types
-				$e = new mb_exception("FT exists");
+				$e = new mb_notice("class_wfsToDb.php: FT exists");
 				if (!WfsToDb::updateFeatureType($currentFeatureType)) {
 					db_rollback();
 					return false;
 				}
 			}
 			else {
-				$e = new mb_exception("FT ne pas exists");
+				$e = new mb_notice("class_wfsToDb.php: FT ne pas exists");
 				// insert new feature types
 				if (!WfsToDb::insertFeatureType($currentFeatureType)) {
 					db_rollback();
@@ -323,8 +323,35 @@
 		}
 		return true;
 	}
-	
+
+
 	/**
+	 * Inserts a new WFS feature type crs into the database.
+	 * 
+	 * @return Boolean
+	 * @param $aWfsFeatureTypeId Integer
+	 * @param $aWfsFeatureTypeCrs String
+	 */
+	private static function insertFeatureTypeCrs ($aWfsFeatureTypeId, $aWfsFeatureTypeCrsString) {
+		$sql = "INSERT INTO wfs_featuretype_epsg (fkey_featuretype_id, epsg) VALUES ($1, $2)";
+		
+		$v = array(
+			$aWfsFeatureTypeId, 
+			$aWfsFeatureTypeCrsString
+		);
+		$t = array("i", "s");
+		
+		$e = new mb_notice("INSERTING FT Crs (FT: $aWfsFeatureTypeId, Crs: $aWfsFeatureTypeCrsString");
+		$res = db_prep_query($sql, $v, $t);
+		
+		if (!$res) {
+			$e = new mb_exception("Error while inserting WFS feature type crs into the database.");
+			return false;
+		}
+		
+		return true;
+	}
+	/**
 	 * Inserts a new WFS feature type element into the database.
 	 * 
 	 * @return Boolean
@@ -453,19 +480,20 @@
 	private static function insertFeatureType ($aWfsFeatureType) {
 		$uuid = new Uuid();
 		$sql = "INSERT INTO wfs_featuretype (fkey_wfs_id, featuretype_name, " . 
-				"featuretype_title, featuretype_abstract, featuretype_searchable, featuretype_srs, uuid) " . 
-				"VALUES($1, $2, $3, $4, $5, $6)";
+				"featuretype_title, featuretype_abstract, featuretype_searchable, featuretype_srs, featuretype_latlon_bbox, uuid) " . 
+				"VALUES($1, $2, $3, $4, $5, $6, $7, $8)";
 
 		$v = array(
 			$aWfsFeatureType->wfs->id,
 			$aWfsFeatureType->name,
 			$aWfsFeatureType->title,
 			$aWfsFeatureType->summary,
-			1, //default to allow search for a inserted featuretype
+			1, //default to allow search for a inserted featuretype (searchable)
 			$aWfsFeatureType->srs,
+			$aWfsFeatureType->latLonBboxArray['minx'].','.$aWfsFeatureType->latLonBboxArray['miny'].','.$aWfsFeatureType->latLonBboxArray['maxx'].','.$aWfsFeatureType->latLonBboxArray['maxy'],
 			$uuid
 		);
-		$t = array('i','s','s','s','i','s','s');
+		$t = array('i','s','s','s','i','s','s','s');
 
 		$e = new mb_notice("INSERTING FT (FT: $aWfsFeatureType->name)");
 		$res = db_prep_query($sql,$v,$t);
@@ -484,7 +512,15 @@
 				return false;	
 			}
 		}
-		
+
+		// insert feature type crs
+		for ($i = 0; $i < count($aWfsFeatureType->crsArray); $i++) {
+			$crs = $aWfsFeatureType->crsArray[$i];
+			if (!WfsToDb::insertFeatureTypeCrs($aWfsFeatureType->id, $crs)) {
+				return false;	
+			}
+		}
+
 		// insert feature type namespaces
 		for ($i = 0; $i < count($aWfsFeatureType->namespaceArray); $i++) {
 			$namespace = $aWfsFeatureType->namespaceArray[$i];
@@ -509,19 +545,21 @@
 		$sql .= "featuretype_title = $1,";
 		$sql .= "featuretype_abstract = $2,";
 		$sql .= "featuretype_searchable = $3,";
-		$sql .= "featuretype_srs = $4 ";
-		$sql .= "WHERE featuretype_id = $5";
+		$sql .= "featuretype_srs = $4, ";
+		$sql .= "featuretype_latlon_bbox = $5 ";
+		$sql .= "WHERE featuretype_id = $6";
 		$v = array(
 			$aWfsFeatureType->title,
 			$aWfsFeatureType->summary,
 			$aWfsFeatureType->searchable,
 			$aWfsFeatureType->srs,
+			$aWfsFeatureType->latLonBboxArray['minx'].','.$aWfsFeatureType->latLonBboxArray['miny'].','.$aWfsFeatureType->latLonBboxArray['maxx'].','.$aWfsFeatureType->latLonBboxArray['maxy'],
 			$aWfsFeatureType->id
 		);
-		$t = array('s','s','s','s','i');
+		$t = array('s','s','s','s','s','i');
 
 		$e = new mb_notice("UPDATING FT (FT: $aWfsFeatureType->id)");
-		$e = new mb_exception("UPDATING FT (FT searchable: $aWfsFeatureType->searchable)");
+		$e = new mb_notice("UPDATING FT (FT searchable: $aWfsFeatureType->searchable)");
 		$res = db_prep_query($sql,$v,$t);
 		if (!$res) {
 			$e = new mb_exception("Error while updating WFS feature type in database.");
@@ -716,7 +754,7 @@
 			$aWfsFeatureType->name
 		);
 		$t = array("i", "s");
-		$e = new mb_exception($sql . " " . print_r($v, true));
+		$e = new mb_notice($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 		if ($row = db_fetch_array($res)) {
 			return $row["featuretype_id"];

Modified: trunk/mapbender/http/classes/class_wfs_1_0_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -180,9 +180,11 @@
 				if($tag == "GETFEATURE" && $element[type] == "open"){
 					$section = "getfeature";
 				}
+
 				if($section == "getfeature" && $tag == "POST"){
 					$myWfs->getFeature = $element[attributes][onlineResource];
 				}
+
 				if($tag == "GETFEATURE" && $element[type] == "close"){
 					$section = "";
 				}			
@@ -190,36 +192,54 @@
 				if($tag == "TRANSACTION" && $element[type] == "open"){
 					$section = "transaction";
 				}
+
 				if($section == "transaction" && $tag == "POST"){
 					$myWfs->transaction = $element[attributes][onlineResource];
 				}
+
 				if($tag == "TRANSACTION" && $element[type] == "close"){
 					$section = "";
 				}
+
 				if($tag == "FEATURETYPE" && $element[type] == "open"){
 					$section = "featuretype";
 				}
+
+				//part for featuretypes
 				if($section == "featuretype" && $tag == "NAME"){
 					$featuretype_name = $element[value];
 				}
+
 				if($section == "featuretype" && $tag == "TITLE"){
 					$featuretype_title = $this->stripEndlineAndCarriageReturn($element[value]);
 				}
+
 				if($section == "featuretype" && $tag == "ABSTRACT"){
 					$featuretype_abstract = $element[value];
 				}
 				if($section == "featuretype" && $tag == "SRS"){
 					$featuretype_srs = $element[value];
-
+				}
+				//The last element to be parsed
+				if($section == "featuretype" && $tag == "LATLONGBOUNDINGBOX"){
+					$featuretype_latlon_minx = $element[attributes][minx];
+					$featuretype_latlon_miny = $element[attributes][miny];
+					$featuretype_latlon_maxx = $element[attributes][maxx];
+					$featuretype_latlon_maxy = $element[attributes][maxy];
+				
 					// Do not add defective featuretypes
 					try {
 						$currentFeatureType = $this->createFeatureTypeFromUrl($myWfs, $featuretype_name);
+					
 						if ($currentFeatureType !== null) {
 							$currentFeatureType->name = $featuretype_name;
 							$currentFeatureType->title = $featuretype_title;
 							$currentFeatureType->summary = $featuretype_abstract;
 							$currentFeatureType->srs = $featuretype_srs;
-
+							$currentFeatureType->latLonBboxArray['minx'] = $featuretype_latlon_minx;
+							$currentFeatureType->latLonBboxArray['miny'] = $featuretype_latlon_miny;
+							$currentFeatureType->latLonBboxArray['maxx'] = $featuretype_latlon_maxx;
+							$currentFeatureType->latLonBboxArray['maxy'] = $featuretype_latlon_maxy;
 							$myWfs->addFeatureType($currentFeatureType);
 						}
 					}

Modified: trunk/mapbender/http/classes/class_wfs_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -89,7 +89,7 @@
 
 		$doc = new DOMDocument();
 		$doc->loadXML($xml);
-		$e = new mb_exception($xml);
+		$e = new mb_notice("class_wfs_1_1_factory.php: Got following FeatureType XML: ".$xml);
 		$xpath =  new DOMXpath($doc);
 		$xpath->registerNamespace("xs","http://www.w3.org/2001/XMLSchema");
 
@@ -175,6 +175,8 @@
 			$myWfs->getCapabilitiesDoc = $admin->char_encode($xml);
 			$myWfs->id = $this->createId();
 
+			$featuretype_crsArray = array();
+	
 			foreach ($values as $element) {
 				$tag = $this->sepNameSpace(strtoupper($element[tag]));
 
@@ -282,19 +284,51 @@
 					$section = "featuretype";
 					$featureTypeNsArray = $element[attributes];
 				}
+
 				if($section == "featuretype" && $tag == "NAME"){
 					$featuretype_name = $element[value];
 				}
+
 				if($section == "featuretype" && $tag == "TITLE"){
 					$featuretype_title = $this->stripEndlineAndCarriageReturn($element[value]);
 				}
+
 				if($section == "featuretype" && $tag == "ABSTRACT"){
 					$featuretype_abstract = $element[value];
 				}
-				
+
+				//<DefaultSRS>urn:ogc:def:crs:EPSG::4326</DefaultSRS><OtherSRS>urn:ogc:def:crs:EPSG::4269</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::3978</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::3857</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::31466</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::25832</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::4258</OtherSRS>
 				if($section == "featuretype" && $tag == "DEFAULTSRS"){
 					$featuretype_srs = $element[value];
+				}
+
+				if($section == "featuretype" && $tag == "OTHERSRS"){
+					$featuretype_crsArray[] = $element[value];
+				}
+				
+
+				//<ows:WGS84BoundingBox dimensions="2"><ows:LowerCorner>-9.16611817848171e+15 -3.4016616708962e+32</ows:LowerCorner><ows:UpperCorner>464605646503609 3.4016616708962e+32</ows:UpperCorner></ows:WGS84BoundingBox>
+
+				if($tag == "WGS84BOUNDINGBOX" && $element[type] == "open"){
+					$section = "bbox";
+				}
+
+				if($section == "bbox" && $tag == "LOWERCORNER"){
+					$lowerCorner = explode(" ",$element[value]);
+					$featuretype_latlon_minx = $lowerCorner[0];
+					$featuretype_latlon_miny = $lowerCorner[1];
+				}
+				//The last element which has to be parsed
+				if($section == "bbox" && $tag == "UPPERCORNER"){
+					$upperCorner = explode(" ",$element[value]);
+					$featuretype_latlon_maxx = $upperCorner[0];
+					$featuretype_latlon_maxy = $upperCorner[1];
+				
+
+				
+				
 					$e = new mb_notice("class_wfs_1_1_factory.php: parse featuretype ".$featuretype_name);
+
 					foreach ( $featureTypeNsArray as $currentNamespace) {
 						$e = new mb_notice("class_wfs_1_1_factory.php: namespace: ".$currentNamespace);
 					}
@@ -306,7 +340,11 @@
 							$currentFeatureType->title = $featuretype_title;
 							$currentFeatureType->summary = $featuretype_abstract;
 							$currentFeatureType->srs = $featuretype_srs;
-
+							$currentFeatureType->latLonBboxArray['minx'] = $featuretype_latlon_minx;
+							$currentFeatureType->latLonBboxArray['miny'] = $featuretype_latlon_miny;
+							$currentFeatureType->latLonBboxArray['maxx'] = $featuretype_latlon_maxx;
+							$currentFeatureType->latLonBboxArray['maxy'] = $featuretype_latlon_maxy;
+							$currentFeatureType->crsArray = $featuretype_crsArray;
 							$myWfs->addFeatureType($currentFeatureType);
 						}
 					}

Modified: trunk/mapbender/http/classes/class_wfs_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_factory.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_wfs_factory.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -21,7 +21,6 @@
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
 require_once(dirname(__FILE__)."/../classes/class_ows_factory.php");
 require_once(dirname(__FILE__)."/../classes/class_wfs_featuretype.php");
-
 /**
  * 
  * @return 
@@ -128,6 +127,13 @@
 				$ft->summary = db_result($res_fe, $cnt_fe, "featuretype_abstract");
 				$ft->searchable = db_result($res_fe, $cnt_fe, "featuretype_searchable");
 				$ft->srs = db_result($res_fe, $cnt_fe, "featuretype_srs");
+				$latLonBbox = db_result($res_fe, $cnt_fe, "featuretype_latlon_bbox");
+				$e = new mb_notice("class_wfs_factory: FT latlonbbox: ".$latLonBbox);
+				$latLonBboxArray = explode(",", $latLonBbox);
+				$ft->latLonBboxArray['minx'] = $latLonBboxArray[0];
+				$ft->latLonBboxArray['miny'] = $latLonBboxArray[1];
+				$ft->latLonBboxArray['maxx'] = $latLonBboxArray[2];
+				$ft->latLonBboxArray['maxy'] = $latLonBboxArray[3];
 				$ft->uuid = db_result($res_fe, $cnt_fe, "uuid");
 				
 				// Elements
@@ -146,6 +152,20 @@
 					$cnt_el++;
 				}
 
+				// Crs
+				$sql_crs = "SELECT epsg FROM wfs_featuretype_epsg WHERE fkey_featuretype_id = $1";
+				$v = array($ft->id);
+				$t = array("i");
+				$res_crs = db_prep_query($sql_crs, $v, $t);
+				$cnt_crs = 0;
+				while(db_fetch_row($res_crs)){
+
+					$ft->addCrs(
+						db_result($res_crs, $cnt_crs, "epsg") 
+					);
+					$cnt_crs++;
+				}
+
 				//Namespaces
 				$sql_ns = "SELECT * FROM wfs_featuretype_namespace WHERE fkey_featuretype_id = $1 ORDER BY namespace";
 				$v = array($ft->id);

Modified: trunk/mapbender/http/classes/class_wfs_featuretype.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_featuretype.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/classes/class_wfs_featuretype.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -28,7 +28,9 @@
 	var $title;
 	var $summary;
 	var $searchable;
-	var $srs;
+	var $srs; // Tag DefaultSRS in wfs 1.1.0+
+	var $latLonBboxArray = array();
+	var $crsArray = array(); //new for wfs 1.1.0+ (tag OtherSRS)
 	var $wfs;
 	var $namespaceArray = array();
 	var $elementArray = array();
@@ -75,6 +77,11 @@
 		return $this;
 	}
 
+	public function addCrs ($crs) {
+		array_push($this->crsArray, $crs);
+		return $this;
+	}
+
 	public function addElement ($name, $type) {
 		$newElement = new stdClass();
 

Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -188,43 +188,93 @@
 function fillISO19139($iso19139, $recordId) {
 	global $admin;
 	global $mb_metadata;
+	$noLayer = false;
+	$noFeaturetype = false;
 	//read out relevant information from mapbender database:
-	//layer and service information:
+
+	//layer and wms information:
 	$sql = <<<SQL
 SELECT layer_id, fkey_wms_id FROM layer INNER JOIN ows_relation_metadata ON 
-(ows_relation_metadata.fkey_layer_id=layer.layer_id)  WHERE ows_relation_metadata.fkey_metadata_id = $1
+(ows_relation_metadata.fkey_layer_id=layer.layer_id)  WHERE ows_relation_metadata.fkey_metadata_id = $1 LIMIT 1
 SQL;
 	//TODO: Problem - the metadata may be used for more than one service - not often but sometimes - does one get the right contact data?
+	//TODO: Problem - this is also the fact if the data is provided by a wfs featuretype! There maybe other contact infos - maybe the info should be integrated more than once and identical info should be identified
 	$e = new mb_exception("used metadata id: ".$mb_metadata['metadata_id']);
 	$v = array($mb_metadata['metadata_id']);
 	$t = array('i');
 	$res = db_prep_query($sql,$v,$t);
 	if (!$res) {
-		$exception = "<exception>No coupled resource found in database!</exception>";
-		return $exception;
+		$noLayer = true;
 	} else {
 		$mb_metadata_coupling = db_fetch_array($res);
 	}
 	$layerId = $mb_metadata_coupling['layer_id'];
-	$wmsId = $mb_metadata_coupling['wms_id'];
+	$wmsId = $mb_metadata_coupling['fkey_wms_id'];
 	$e = new mb_notice("mod_dataISOMetadata.php: Found coupled layer with id: ".$layerId);
-	if ($wmsView != '') {
-		$sql = "SELECT * ";
-		$sql .= "FROM ".$wmsView." WHERE layer_id = $1";
+
+
+
+	//featuretype and wfs information:
+	$sql = <<<SQL
+SELECT featuretype_id, fkey_wfs_id FROM wfs_featuretype INNER JOIN ows_relation_metadata ON 
+(ows_relation_metadata.fkey_featuretype_id=wfs_featuretype.featuretype_id) WHERE ows_relation_metadata.fkey_metadata_id = $1 LIMIT 1
+SQL;
+	//TODO: Problem - the metadata may be used for more than one service - not often but sometimes - does one get the right contact data?
+	//TODO: Problem - this is also the fact if the data is provided by a wfs featuretype! There maybe other contact infos - maybe the info should be integrated more than once and identical info should be identified
+	$e = new mb_exception("used metadata id: ".$mb_metadata['metadata_id']);
+	$v = array($mb_metadata['metadata_id']);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	if (!$res) {
+		$noFeaturetype = true;
+	} else {
+		$mb_metadata_coupling = db_fetch_array($res);
 	}
-	else {
-	//next function is for normal mapbender installations and read the info directly from the wms and layer tables
+	$featuretypeId = $mb_metadata_coupling['featuretype_id'];
+	$wfsId = $mb_metadata_coupling['fkey_wfs_id'];
+	$e = new mb_notice("mod_dataISOMetadata.php: Found coupled featuretype with id: ".$featuretypeId);
+	//if no coupled resource was found - the metadata cannot be created
+	/*if ($noFeaturetype == true && $noFeaturetype == true) {
+		$exception = "<exception>No coupled service ressource found - metadata cannot be created</exception>";
+		return $exception;
+	}*/
+	
+	/*if (!isset($featuretypeId)) {
+		echo "<exception>no featuretype coupled</exception>";
+		die();
+	}*/
+
+		if ($wmsView != '') {
+			$sql = "SELECT * ";
+			$sql .= "FROM ".$wmsView." WHERE layer_id = $1";
+		}
+		else {
+		//next function is for normal mapbender installations and read the info directly from the wms and layer tables
+			$sql = "SELECT ";
+			$sql .= "layer.layer_id,layer.layer_name, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, layer.layer_minscale, layer.layer_maxscale, layer.uuid,";
+			$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
+			$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
+			$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, wms.wms_owsproxy,";
+			$sql .= "wms.contactelectronicmailaddress, wms.country, wms.fkey_mb_group_id, ";
+			$sql .= "layer_epsg.minx || ',' || layer_epsg.miny || ',' || layer_epsg.maxx || ',' || layer_epsg.maxy  as bbox ";
+			$sql .= "FROM wms, layer, layer_epsg WHERE layer_id = $1 and layer.fkey_wms_id = wms.wms_id";
+			$sql .= " and layer_epsg.fkey_layer_id=layer.layer_id and layer_epsg.epsg='EPSG:4326'";
+			$v = array((integer)$layerId);
+		}
+/*
+// noFeaturetype = false
 		$sql = "SELECT ";
-		$sql .= "layer.layer_id,layer.layer_name, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, layer.layer_minscale, layer.layer_maxscale, layer.uuid,";
-		$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
-		$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
-		$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, wms.wms_owsproxy,";
-		$sql .= "wms.contactelectronicmailaddress, wms.country, wms.fkey_mb_group_id, ";
-		$sql .= "layer_epsg.minx || ',' || layer_epsg.miny || ',' || layer_epsg.maxx || ',' || layer_epsg.maxy  as bbox ";
-		$sql .= "FROM wms, layer, layer_epsg WHERE layer_id = $1 and layer.fkey_wms_id = wms.wms_id";
-		$sql .= " and layer_epsg.fkey_layer_id=layer.layer_id and layer_epsg.epsg='EPSG:4326'";
+			$sql .= "wfs_featuretype.featuretype_id,wfs_featuretype.featuretype_name, wfs_featuretype.featuretype_title, wfs_featuretype.featuretype_abstract,  wfs_featuretype.uuid,";
+			$sql .= "wfs.wfs_title, wfs.wfs_abstract, wfs.wfs_id, wfs.fees, wfs.accessconstraints, wfs.individualname, ";
+			$sql .= "wfs.positionname, wfs.providername, wfs.deliverypoint, wfs.city, wfs_timestamp, wfs_owner, ";
+			$sql .= "wfs.administrativearea, wfs.postalcode, wfs.voice, wfs.facsimile, wfs.wfs_owsproxy,";
+			$sql .= "wfs.electronicmailaddress, wfs.country, wfs.fkey_mb_group_id, ";
+			$sql .= "layer_epsg.minx || ',' || layer_epsg.miny || ',' || layer_epsg.maxx || ',' || layer_epsg.maxy  as bbox ";
+			$sql .= "FROM wms, layer, layer_epsg WHERE layer_id = $1 and layer.fkey_wms_id = wms.wms_id";
+			$sql .= " and layer_epsg.fkey_layer_id=layer.layer_id and layer_epsg.epsg='EPSG:4326'";
+			$v = array((integer)$featuretypeId);
 	}
-	$v = array((integer)$layerId);
+*/
 	$t = array('i');
 	$res = db_prep_query($sql,$v,$t);
 	$mapbenderMetadata = db_fetch_array($res);
@@ -831,7 +881,7 @@
 		
 	}
 	//generate keyword part - for services the inspire themes are not applicable!!!**********
-	//read keywords for resource out of the database:
+	//read keywords for resource out of the database/not only layer keywords also featuretype keywords if given!
 	$sql = "SELECT keyword.keyword FROM keyword, layer_keyword WHERE layer_keyword.fkey_layer_id=$1 AND layer_keyword.fkey_keyword_id=keyword.keyword_id";
 	$v = array((integer)$layerId);
 	$t = array('i');

Modified: trunk/mapbender/http/php/mod_loadwfs.php
===================================================================
--- trunk/mapbender/http/php/mod_loadwfs.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/php/mod_loadwfs.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -19,7 +19,7 @@
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 require_once(dirname(__FILE__)."/mb_validateInput.php");
-require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php"); 
+require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
 require_once(dirname(__FILE__)."/../classes/class_gui.php"); 
 
 echo "file: ".$_REQUEST["xml_file"];
@@ -45,4 +45,4 @@
 }
 
 echo $myWfs;
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/plugins/mb_metadata_wfs_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_wfs_server.php	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/http/plugins/mb_metadata_wfs_server.php	2012-05-07 09:54:47 UTC (rev 8342)
@@ -876,7 +876,7 @@
 		$spatial_res_value = '';
 		$inspire_charset = '';
 		$randomid = new Uuid();	
-		$e = new mb_exception("File to load: ".$filename);
+		$e = new mb_notice("File to load: ".$filename);
 		//read out objects from xml structure
 		/*if (file_exists($filename)) {
 			try {	
@@ -901,7 +901,7 @@
 		$output = preg_replace($regex,"",$output);
 		//$e = new mb_exception($output);
 		$iso19139Xml = simplexml_load_string($output);
-		$e = new mb_exception('');
+		//$e = new mb_notice('');
 		
 		//get elements for database from xml by using xpath
 		//uuid
@@ -925,7 +925,7 @@
 		$datasetid = 'undefined';
 		$code = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString');
 		if (isset($code[0]) && $code[0] != '') {
-			$e = new mb_exception("plugins/mb_metadata_server.php: code given thru MD_Identifier: ".$code[0]);
+			$e = new mb_notice("plugins/mb_metadata_server.php: code given thru MD_Identifier: ".$code[0]);
 			//check if code is defined by codespace and code
 			$codeSplit = explode("#",$code);
 			if (isset($codeSplit[0]) && $codeSplit[0] != '' && isset($codeSplit[1]) && $codeSplit[1] != '') {
@@ -1044,7 +1044,10 @@
 		getWfs($wfsId);
 		
 		$wfsFactory = new UniversalWfsFactory();
+		
 		$wfs = $wfsFactory->createFromDb($wfsId, false);
+		
+
 		if (is_null($wfs)) {
 			$ajaxResponse->setSuccess(false);
 			$ajaxResponse->setMessage(_mb("Invalid WFS ID."));
@@ -1084,12 +1087,12 @@
 		if (is_array($data->wfs->featuretype_searchable)) {
 			foreach ($wfs->featureTypeArray as &$featuretype) {//for each existing featuretype
 				$featuretype->searchable = 0;//initialize new
-				$e = new mb_exception("mb_metadata_wfs_server.php: Check ft with id ".$featuretype->id." to be searchable");
+				$e = new mb_notice("mb_metadata_wfs_server.php: Check ft with id ".$featuretype->id." to be searchable");
 				for ($i = 0; $i < count($data->wfs->featuretype_searchable); $i++) {
 					$id = $data->wfs->featuretype_searchable[$i];
 					$e = new mb_notice("mb_metadata_wfs_server.php: ft with id ".$id." found to be searchable");
 					if ($id == intval($featuretype->id)) {
-						$e = new mb_exception("mb_metadata_wfs_server.php: ft identical - update it in wfs object");
+						$e = new mb_notice("mb_metadata_wfs_server.php: ft identical - update it in wfs object");
 						$featuretype->searchable = 1;					
 					} else {
 						continue; //with next 

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2012-05-03 15:35:37 UTC (rev 8341)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2012-05-07 09:54:47 UTC (rev 8342)
@@ -388,6 +388,29 @@
 
 ALTER TABLE ows_relation_metadata ADD COLUMN internal INTEGER;
 
+--new table for wfs featuretype supported crs - new up from wfs 1.1.0 - the bbox are normally not filled!
 
+CREATE TABLE wfs_featuretype_epsg
+(
+  fkey_featuretype_id integer NOT NULL DEFAULT 0,
+  epsg character varying(50) NOT NULL DEFAULT ''::character varying,
+  minx double precision DEFAULT 0,
+  miny double precision DEFAULT 0,
+  maxx double precision DEFAULT 0,
+  maxy double precision DEFAULT 0,
+  CONSTRAINT wfs_featuretype_epsg_ibfk_1 FOREIGN KEY (fkey_featuretype_id)
+      REFERENCES wfs_featuretype (featuretype_id) MATCH SIMPLE
+      ON UPDATE CASCADE ON DELETE CASCADE
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE wfs_featuretype_epsg OWNER TO postgres;
 
+-- Column: featuretype_latlon_bbox
 
+-- ALTER TABLE wfs_featuretype DROP COLUMN featuretype_latlon_bbox;
+
+ALTER TABLE wfs_featuretype ADD COLUMN featuretype_latlon_bbox character varying;
+
+



More information about the Mapbender_commits mailing list