[Mapbender-commits] r2495 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jun 10 05:35:31 EDT 2008
Author: christoph
Date: 2008-06-10 05:35:31 -0400 (Tue, 10 Jun 2008)
New Revision: 2495
Modified:
trunk/mapbender/http/classes/class_gml2.php
Log:
removed hard wired "the_geom"
Modified: trunk/mapbender/http/classes/class_gml2.php
===================================================================
--- trunk/mapbender/http/classes/class_gml2.php 2008-06-09 14:24:10 UTC (rev 2494)
+++ trunk/mapbender/http/classes/class_gml2.php 2008-06-10 09:35:31 UTC (rev 2495)
@@ -427,6 +427,49 @@
return $nodeName;
}
+ /**
+ * Parses the feature segment of a GML and stores the geometry in the
+ * $geometry variable of the class.
+ *
+ * Example of a feature segment of a GML.
+ * <gml:featureMember>
+ * <ms:ROUTE fid="ROUTE.228168">
+ * <gml:boundedBy>
+ * <gml:Box srsName="EPSG:31466">
+ * <gml:coordinates>2557381.0,5562371.1 2557653.7,5562526.0</gml:coordinates>
+ * </gml:Box>
+ * </gml:boundedBy>
+ * <ms:geometry>
+ * <gml:LineString>
+ * <gml:coordinates>
+ * 2557380.97,5562526 2557390.96,
+ * 5562523.22 2557404.03,5562518.2 2557422.31,
+ * 5562512 2557437.16,5562508.37 2557441.79,
+ * 5562507.49 2557454.31,5562505.1 2557464.27,
+ * 5562503.97 2557473.24,5562502.97 2557491.67,
+ * 5562502.12 2557505.65,5562502.43 2557513.78,
+ * 5562501.12 2557520.89,5562498.79 2557528.5,
+ * 5562495.07 2557538.9,5562488.91 2557549.5,
+ * 5562483.83 2557558.55,5562476.61 2557569.07,
+ * 5562469.82 2557576.61,5562462.72 2557582.75,
+ * 5562457.92 2557588.57,5562452.56 2557590.38,
+ * 5562449.69 2557593.57,5562445.07 2557596.17,
+ * 5562441.31 2557601.71,5562433.93 2557612.97,
+ * 5562421.03 2557626,5562405.33 2557639.66,
+ * 5562389.75 2557653.69,5562371.12
+ * </gml:coordinates>
+ * </gml:LineString>
+ * </ms:geometry>
+ * <code>354</code>
+ * <Verkehr>0</Verkehr>
+ * <rlp>t</rlp>
+ * </ms:ROUTE>
+ * </gml:featureMember>
+ *
+ * @return void
+ * @param $domNode DOMNodeObject the feature tag of the GML
+ * (<gml:featureMember> in the above example)
+ */
public function parse($domNode) {
$currentSibling = $domNode->firstChild;
@@ -443,10 +486,14 @@
$ns = $namespace['ns'];
$columnName = $namespace['value'];
- if ($name==$ns.":the_geom"){
+ // check if this node is a geometry node.
+ // however, even if it is a property node,
+ // it has a child node, the text node!
+ // So we might need to do something more
+ // sophisticated here...
+ if ($currentSibling->hasChildNodes()){
$geomNode = $currentSibling->firstChild;
$geomType = $geomNode->nodeName;
-// echo "geomtype: " . $geomType . "<br>";
switch ($geomType) {
case "gml:Polygon" :
$this->geometry = new GMLPolygon();
@@ -459,27 +506,28 @@
case "gml:Point" :
$this->geometry = new GMLPoint();
$this->geometry->parsePoint($geomNode);
-# $this->properties["Mapbender:icon"] = "../img/sy_star.png";
break;
case "gml:MultiLineString" :
$this->geometry = new GMLMultiLine();
$this->geometry->parseMultiLine($geomNode);
-// $this->properties["Mapbender:icon"] = "../img/sy_star.png";
break;
case "gml:MultiPolygon" :
$this->geometry = new GMLMultiPolygon();
$this->geometry->parseMultiPolygon($geomNode);
-// $this->properties["Mapbender:icon"] = "../img/sy_star.png";
break;
+ default:
+ $this->properties[$columnName] = $value;
+ break;
}
- } else {
- $this->properties[$columnName] = $value;
+ }
+ else {
+ $this->properties[$columnName] = $value;
}
$currentSibling = $currentSibling->nextSibling;
}
}
-
+
public function toGeoJSON () {
$str = "";
$str .= "{\"type\":\"Feature\", \"id\":\"".$this->fid."\", \"geometry\": ";
More information about the Mapbender_commits
mailing list