[Mapbender-commits] r1997 - branches/2.5/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 21 03:34:51 EST 2008


Author: christoph
Date: 2008-01-21 03:34:51 -0500 (Mon, 21 Jan 2008)
New Revision: 1997

Modified:
   branches/2.5/http/classes/class_kml_parser_ows.php
Log:
parseGeoJSON: check if properties exist before handling them

Modified: branches/2.5/http/classes/class_kml_parser_ows.php
===================================================================
--- branches/2.5/http/classes/class_kml_parser_ows.php	2008-01-21 08:32:34 UTC (rev 1996)
+++ branches/2.5/http/classes/class_kml_parser_ows.php	2008-01-21 08:34:51 UTC (rev 1997)
@@ -37,6 +37,8 @@
 	}
 	
 	public function parseGeoJSON ($geoJSON, $kmlId) {
+		
+//		$e = new mb_notice("GEOJSON: " . $geoJSON);
 		$json = new Services_JSON();
 		$geometryFromGeoJSON = $json->decode($geoJSON);
 		$id = 0;
@@ -75,17 +77,20 @@
 					if ($currentGeometry) {
 						$currentPlacemark = new KMLPlacemark($currentGeometry);
 
-						foreach ($feature->properties as $key => $value) {
-							$currentPlacemark->setProperty($key, $value);
+						if (gettype($feature->properties) == "object") {
+							
+							foreach ($feature->properties as $key => $value) {
+								$currentPlacemark->setProperty($key, $value);
+							}
+							$currentPlacemark->setProperty("Mapbender:kml", true);
+							$currentPlacemark->setProperty("Mapbender:name", "unknown");
+							$currentPlacemark->setProperty("Mapbender:id", $kmlId);
+							$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
+							$e = new mb_notice("adding to placemarkArray (current length: " . count($this->placemarkArray) . ")");
+							array_push($this->placemarkArray, $currentPlacemark);
+							$e = new mb_notice("added...new length: " . count($this->placemarkArray));
+							$id ++;
 						}
-						$currentPlacemark->setProperty("Mapbender:kml", true);
-						$currentPlacemark->setProperty("Mapbender:name", "unknown");
-						$currentPlacemark->setProperty("Mapbender:id", $kmlId);
-						$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
-						$e = new mb_notice("adding to placemarkArray (current length: " . count($this->placemarkArray) . ")");
-						array_push($this->placemarkArray, $currentPlacemark);
-						$e = new mb_notice("added...new length: " . count($this->placemarkArray));
-						$id ++;
 					}
 				}
 			}



More information about the Mapbender_commits mailing list