[Mapbender-commits] r10150 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 17 02:52:29 PDT 2019


Author: armin11
Date: 2019-06-17 02:52:28 -0700 (Mon, 17 Jun 2019)
New Revision: 10150

Modified:
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/javascripts/mod_renderGML.php
Log:
Fix for zooming to other geometry types than multipolygon - thanx to peter.lang ;-)

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2019-06-14 07:38:08 UTC (rev 10149)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2019-06-17 09:52:28 UTC (rev 10150)
@@ -711,8 +711,22 @@
 				$epsg = "EPSG:".$currentEpsg
 			);
 			$wmcGetApi->mainMap->setExtent($bbox);
-		} else {
-			$e = new mb_notice("javascripts/initWmcObj.php: no GML found in session!");
+		} else { //no multipolygon found
+			$e = new mb_notice("javascripts/initWmcObj.php: Other geometry than MultiPolygon found in session - try to parse it with mapbenders gml2 class!");
+			$gml = new gml2();
+                        $gml->parse_xml($gml_string);
+                        $bboxArray = $gml->bbox;
+                        $currentEpsg = Mapbender::session()->get("epsg");
+                        //create mapbender bbox object to zoom to
+                        $bbox = new Mapbender_bbox(
+                                $bboxArray[0],
+                                $bboxArray[1],
+                                $bboxArray[2],
+                                $bboxArray[3],
+                                $epsg = "EPSG:".$currentEpsg
+
+                        );
+                        $wmcGetApi->mainMap->setExtent($bbox);
 		}
 	}
 }

Modified: trunk/mapbender/http/javascripts/mod_renderGML.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_renderGML.php	2019-06-14 07:38:08 UTC (rev 10149)
+++ trunk/mapbender/http/javascripts/mod_renderGML.php	2019-06-17 09:52:28 UTC (rev 10150)
@@ -67,7 +67,11 @@
 //$e = new mb_exception("renderGml invoked!");
 if ($gml_string) {
 	$gml = new gml2();
-	$gml->parse_xml('<FeatureCollection xmlns:gml="http://www.opengis.net/gml"><featureMember><the_geom>'.$multiPolygonGml.'</the_geom></featureMember></FeatureCollection>');
+	isset(isset($multiPolygonGml)) {
+		$gml->parse_xml('<FeatureCollection xmlns:gml="http://www.opengis.net/gml"><featureMember><the_geom>'.$multiPolygonGml.'</the_geom></featureMember></FeatureCollection>');
+	} else {
+		$gml->parse_xml($gml_string);
+	}
 	echo "Mapbender.events.afterInit.register(highlight_init);\n";
 	echo "function highlight_init() {\n";
 	echo "var mf = new Array(";



More information about the Mapbender_commits mailing list