[Mapbender-commits] r4633 - branches/2.6/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Sep 15 11:43:17 EDT 2009


Author: christoph
Date: 2009-09-15 11:43:16 -0400 (Tue, 15 Sep 2009)
New Revision: 4633

Modified:
   branches/2.6/http/classes/class_gml_factory.php
Log:
workaround for both Mapserver and other WFS clients

Modified: branches/2.6/http/classes/class_gml_factory.php
===================================================================
--- branches/2.6/http/classes/class_gml_factory.php	2009-09-15 15:34:31 UTC (rev 4632)
+++ branches/2.6/http/classes/class_gml_factory.php	2009-09-15 15:43:16 UTC (rev 4633)
@@ -183,6 +183,7 @@
 			$wfsFactory = new UniversalWfsFactory();
 			$myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
 			if (is_null($myWfs)) {
+				new mb_exception("class_gml_factory.php: createFromXml: WFS not found! ID: " . $wfsConf->wfsId);
 				return null;
 			}
 			$featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
@@ -202,7 +203,9 @@
 			// build feature collection
 			$gml->featureCollection = new FeatureCollection();
 			
-			// segments of the featureCollection		
+			// segments of the featureCollection
+			//
+			// for *non* Mapserver WFS
 			$gmlFeatureMembers = $gmlDoc->xpath("//gml:featureMember");
 			if (count($gmlFeatureMembers) > 0) {
 				foreach ($gmlFeatureMembers as $gmlFeatureMember) {
@@ -214,6 +217,22 @@
 					}
 				}
 			}
+			// for Mapserver WFS
+			else {
+				// segments of the featureCollection
+				$gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
+	
+				if (count($gmlFeatureMembers) > 0) {
+					foreach ($gmlFeatureMembers as $gmlFeatureMember) {
+						$gmlfeatureMember_dom = dom_import_simplexml($gmlFeatureMember);
+						$feature = new Feature();
+						$this->parseFeature($gmlfeatureMember_dom, $feature, $wfsConf);
+						if (isset($feature->geometry)) {
+							$gml->featureCollection->addFeature($feature);
+						}
+					}
+				}			
+			}
 			return $gml;
 		}
 		catch (Exception $e) {



More information about the Mapbender_commits mailing list