svn commit: r874 - trunk/mapbender/http/classes/class_gml2.php
christoph at osgeo.org
christoph at osgeo.org
Mon Nov 20 09:40:04 EST 2006
Author: christoph
Date: 2006-11-20 14:40:04+0000
New Revision: 874
Modified:
trunk/mapbender/http/classes/class_gml2.php
Log:
improve handling of gml namespaces
Modified: trunk/mapbender/http/classes/class_gml2.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/classes/class_gml2.php?view=diff&rev=874&p1=trunk/mapbender/http/classes/class_gml2.php&p2=trunk/mapbender/http/classes/class_gml2.php&r1=873&r2=874
==============================================================================
--- trunk/mapbender/http/classes/class_gml2.php (original)
+++ trunk/mapbender/http/classes/class_gml2.php 2006-11-20 14:40:04+0000
@@ -51,6 +51,7 @@
$section = false;
$geom = false;
$boundedBy = false;
+ $coordinates = false;
$el = -1;
$parser = xml_parser_create(CHARSET);
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
@@ -65,16 +66,16 @@
xml_parser_free($parser);
foreach ($values as $element) {
- if(strtoupper($element[tag]) == strtoupper("gml:boundedBy") && $element[type] == "open"){
+ if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("boundedBy") && $element[type] == "open"){
$boundedBy = true;
}
if ($boundedBy) {
- if(strtoupper($element[tag]) == strtoupper("gml:coordinates")){
+ if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("coordinates")){
$this->bbox = explode(",", str_replace(",,","",str_replace(" ",",",trim($element[value]))));
$boundedBy=false;
}
}
- if(strtoupper($element[tag]) == strtoupper("gml:featureMember") && $element[type] == "open"){
+ if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("featureMember") && $element[type] == "open"){
$this->member++;
$this->keys[$this->member] = array();
$this->value[$this->member] = array();
@@ -87,14 +88,25 @@
$geom = true;
$this->geomtype[$this->member] = $this->sepNameSpace($element[tag]);
}
- else if(strtoupper($element[tag]) == strtoupper("gml:coordinates") && $geom == true){
- $this->geometry[$this->member][$cnt_geom] = str_replace(",,","",str_replace(" ",",",trim($element[value])));
- }
else if(in_array($this->sepNameSpace($element[tag]),$this->geometries) && $element[type] == "close"){
$cnt_geom++;
$geom = false;
}
- else if(strtoupper($element[tag]) == strtoupper("gml:featureMember") && $element[type] == "close"){
+ if($geom == true){
+ if (strtoupper($this->sepNameSpace($element[tag])) == strtoupper("coordinates")) {
+ $this->geometry[$this->member][$cnt_geom] = str_replace(",,","",str_replace(" ",",",trim($element[value])));
+ $coordinates = true;
+ }
+ else if (!$coordinates && trim($element[value])) {
+ $coords = str_replace(",,","",str_replace(" ",",",trim($element[value])));
+ $tmp_array = explode(",", $coords);
+ if (count($tmp_array > 1)) {
+ $this->geometry[$this->member][$cnt_geom] = $coords;
+ $coordinates = true;
+ }
+ }
+ }
+ else if(strtoupper($this->sepNameSpace($element[tag])) == strtoupper("featureMember") && $element[type] == "close"){
$section = false;
$el = -1;
}
@@ -202,9 +214,11 @@
for ($k=0; $k<count($x_array); $k++) {
$js .= "q.get(-1).addPointByCoordinates(parseFloat(".$x_array[$k]."), parseFloat(".$y_array[$k]."));\n";
+ //$js .= "alert(parseFloat(".$x_array[$k]."), parseFloat(".$y_array[$k]."));";
}
$js .= "q.get(-1).close();\n";
}
+// $js .= "alert(q);\n";
return $js;
}
}
More information about the Mapbender_commits
mailing list