[Mapbender-commits] r8308 - trunk/mapbender/http/geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Apr 11 01:10:31 EDT 2012


Author: armin11
Date: 2012-04-10 22:10:31 -0700 (Tue, 10 Apr 2012)
New Revision: 8308

Modified:
   trunk/mapbender/http/geoportal/gaz_geom_mobile.php
Log:
Less exceptions

Modified: trunk/mapbender/http/geoportal/gaz_geom_mobile.php
===================================================================
--- trunk/mapbender/http/geoportal/gaz_geom_mobile.php	2012-04-10 19:06:11 UTC (rev 8307)
+++ trunk/mapbender/http/geoportal/gaz_geom_mobile.php	2012-04-11 05:10:31 UTC (rev 8308)
@@ -88,16 +88,16 @@
 or die('Verbindungsaufbau fehlgeschlagen: ' . pg_last_error());
 
 function replaceChars($text){
-	$search = array( "ä",  "ö",  "ü",  "Ä",  "Ö",  "Ü",  "ß","tr." );
-	$repwith = array("ae", "oe", "ue", "AE", "OE", "UE", "ss","tr");
+	$search = array( "ä",  "ö",  "ü",  "Ä",  "Ö",  "Ü", "tr.", "ß" );
+	$repwith = array("ae", "oe", "ue", "AE", "OE", "UE", "tr","ss");
 	
-	if(CHARSET=="UTF-8")
-		$text = utf8_decode($text);
+	//if(CHARSET=="UTF-8")
+	//	$text = utf8_decode($text);
 
 	$ret = str_replace($search, $repwith, $text);
 
-	if(CHARSET=="UTF-8")
-		$ret = utf8_encode($ret);
+	//if(CHARSET=="UTF-8")
+	//	$ret = utf8_encode($ret);
 
 	return $ret;
 }
@@ -135,12 +135,15 @@
 $e = new mb_exception("gaz_geom_mobile was invoked with string:".$sstr);
 /****** Workflow *********************************/
 /**/
+$test = str_replace("ß", "ss", $sstr);
+$e = new mb_notice("replaced test string: ".$test);
 $astr = split(",",replaceChars($sstr));
+$e = new mb_notice("replaced string: ".$astr[0]." ".$astr[1]." ".$astr[2]);
 //if only one string without any comma is given
 if(count($astr) == 1){
 
 	$astr[0] = trim($astr[0]);
-	$e = new mb_exception("gaz_geom_mobile: only one string detected: ".$astr[0]);
+	$e = new mb_notice("gaz_geom_mobile: only one string detected: ".$astr[0]);
 	//check if there may be a postal code
 	$plz = getPlz($astr[0]);
 	//check if there is a housenumber
@@ -165,7 +168,7 @@
 //if 2 parts are given - the first one may be a combined or a single value
 // '56743 mendig' or 'ferdinand-sauerbruch-strasse 15' or 'koblenz' or 'mendig' or, or, or ...
 else if(count($astr) == 2){
-	$e = new mb_exception("gaz_geom_mobile: two strings detected: ".$astr[0]." and ".$astr[1]);
+	$e = new mb_notice("gaz_geom_mobile: two strings detected: ".$astr[0]." and ".$astr[1]);
 	$astr[0] = trim($astr[0]);
 	$astr[1] = trim($astr[1]);
 	$ckeys = array();
@@ -182,7 +185,7 @@
 	// check first entry for postal code
 	if(getPlz($astr[0])){
 		$myplz = getPlz($astr[0]);
-		$e = new mb_exception("gaz_geom_mobile: postalcode detected: ".$myplz);
+		$e = new mb_notice("gaz_geom_mobile: postalcode detected: ".$myplz);
 		if(getNr($astr[1])){
 			$mynr = getNr($astr[1]);
 			$myzs = getAppendix($astr[1]);
@@ -197,7 +200,7 @@
 		$mynr = getNr($astr[0]);
 		$myzs = getAppendix($astr[0]);
 		$mystr = getStrn($astr[0]);
-		$e = new mb_exception('gaz_geom_mobile: search for streetname: '.$mystr);
+		$e = new mb_notice('gaz_geom_mobile: search for streetname: '.$mystr);
 		//check if in second value there is a postalcode
 		if(getPlz($astr[1])){
 			$myplz = getPlz($astr[1]);
@@ -205,7 +208,7 @@
 		//maybe it will be a city name
 		else{
 			$mycity = trim($astr[1]);
-			$e = new mb_exception('gaz_geom_mobile: search for city: '.$mycity);
+			$e = new mb_notice('gaz_geom_mobile: search for city: '.$mycity);
 		}
 	}
 	//check second for postal code
@@ -226,8 +229,12 @@
 	}
 	// workflow
 	if(count($both) == 2){
-		$a = "%".strtoupper(trim($both[0]))."%";
-		$b = "%".strtoupper(trim($both[1]))."%";
+		//$a = "%".strtoupper(trim($both[0]))."%";
+		//$b = "%".strtoupper(trim($both[1]))."%";
+		$a = strtoupper(trim($both[0]))."%";
+		$b = strtoupper(trim($both[1]))."%";
+
+
 		$v = array($a, $a);
 		$t = array('s', 's');
 		$sql = "SELECT DISTINCT * FROM (SELECT DISTINCT gem_schl_neu, gemeinde AS gem FROM gis.verwaltungseinheit ";
@@ -272,7 +279,7 @@
 				$res = db_prep_query($sql,$v,$t);
 				while($row = db_fetch_array($res)){
 					$show = encode($row["str_name_ewois"])."  ".$cnames[$i];
-					$e = new mb_exception('gaz_geom_mobile: street found: '.$row["str_name_ewois"]);
+					$e = new mb_notice('gaz_geom_mobile: street found: '.$row["str_name_ewois"]);
 					stack_it($arraySTR,"str",$show,"str",$row["srid"],$row["minx"],$row["miny"],$row["maxx"],$row["maxy"],$row["gml"]);
 				}
 			}
@@ -333,7 +340,8 @@
 		if(count($ckeys)>0){
 			for($i=0; $i<count($ckeys); $i++){	
 				
-				$v = array($ckeys[$i], "%". strtoupper(trim($s)). "%");
+				//$v = array($ckeys[$i], "%". strtoupper(trim($s)). "%");
+				$v = array($ckeys[$i], strtoupper(trim($s)). "%");
 				$t = array('i', 's');
 				$sql = "SELECT DISTINCT str_schl_alt ";
 				$sql .= "FROM gis.strassenschluessel WHERE gem_schl = $1 ";
@@ -341,7 +349,7 @@
 				$res = db_prep_query($sql,$v,$t);
 				while($row = db_fetch_array($res)){
 					array_push($str_schl, $row['str_schl_alt']);
-					$e = new mb_exception('gaz_geom_mobile: strassenschluessel: '.$row["str_schl_alt"].' for '.$s.' found' );	
+					$e = new mb_notice('gaz_geom_mobile: strassenschluessel: '.$row["str_schl_alt"].' for '.$s.' found' );	
 					array_push($str_schl_gem, $cnames[$i]);
 				}
 			}
@@ -401,7 +409,8 @@
 		$sql .= "(ymax(the_geom) + ".$bufferSH.") as maxy ";
 		$sql .= "FROM gis.hauskoordinaten ";
 		$sql .= "WHERE name ILIKE $1 AND hausnummer = $2 ";
-		$v = array("%".$s."%",$h);
+		//$v = array("%".$s."%",$h);
+		$v = array($s."%",$h);
 		$t = array('s','i');
 		if($z){
 			$sql .= "AND zusatz = $" . (count($v)+1);
@@ -426,7 +435,7 @@
 		while($row = db_fetch_array($res)){
 			
 			$show = utf8_decode($row["name"])." ".$row["hausnummer"];
-			$e = new mb_exception('gaz_geom_mobile.php: streetname2: '.utf8_decode($row["name"]));
+			$e = new mb_notice('gaz_geom_mobile.php: streetname2: '.utf8_decode($row["name"]));
 			//$show = $row["name"]." ".$row["hausnummer"]; TODO: see above
 			if($row["zusatz"] != null){
 				$show .= $row["zusatz"];	



More information about the Mapbender_commits mailing list