[Mapbender-commits] r8716 - in trunk/mapbender/http: classes javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Oct 7 07:37:38 PDT 2013
Author: armin11
Date: 2013-10-07 07:37:38 -0700 (Mon, 07 Oct 2013)
New Revision: 8716
Modified:
trunk/mapbender/http/classes/class_gml_2_factory.php
trunk/mapbender/http/classes/class_ows.php
trunk/mapbender/http/classes/class_wfs.php
trunk/mapbender/http/javascripts/mod_wfsGazetteerEditor_server.php
Log:
Some bugfix for debian squeeze php 5.3.3-7 - access to dom via getAttribute was not possible
Modified: trunk/mapbender/http/classes/class_gml_2_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_2_factory.php 2013-10-07 12:58:02 UTC (rev 8715)
+++ trunk/mapbender/http/classes/class_gml_2_factory.php 2013-10-07 14:37:38 UTC (rev 8716)
@@ -267,8 +267,11 @@
// sophisticated here...
if ($currentSibling->hasChildNodes() && $isGeomColumn){
$geomNode = $currentSibling->firstChild;
- if ($geomNode->hasAttribute("srsName")) {
- $srs = $geomNode->getAttribute("srsName");
+
+ if ($geomNode->nodeType == XML_ELEMENT_NODE) {
+ if ($geomNode->hasAttribute("srsName")) {
+ $srs = $geomNode->getAttribute("srsName");
+ }
}
//if srsName of featureMember is empty, use the srsName of node //gml:boundedBy/gml:Envelope
if($srs == "") {
Modified: trunk/mapbender/http/classes/class_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_ows.php 2013-10-07 12:58:02 UTC (rev 8715)
+++ trunk/mapbender/http/classes/class_ows.php 2013-10-07 14:37:38 UTC (rev 8716)
@@ -134,4 +134,4 @@
}
-?>
\ No newline at end of file
+?>
Modified: trunk/mapbender/http/classes/class_wfs.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs.php 2013-10-07 12:58:02 UTC (rev 8715)
+++ trunk/mapbender/http/classes/class_wfs.php 2013-10-07 14:37:38 UTC (rev 8716)
@@ -102,7 +102,6 @@
if ($filter != null) {
$url .= "&filter=" . urlencode($filter);
}
- $e = new mb_exception("class_wfs.php: url: ".$url);
return $this->get($url);
}
Modified: trunk/mapbender/http/javascripts/mod_wfsGazetteerEditor_server.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfsGazetteerEditor_server.php 2013-10-07 12:58:02 UTC (rev 8715)
+++ trunk/mapbender/http/javascripts/mod_wfsGazetteerEditor_server.php 2013-10-07 14:37:38 UTC (rev 8716)
@@ -51,11 +51,11 @@
$exec = $pathOgr .' -a_srs EPSG:'.$srs.' -f "ESRI Shapefile" '.$unique.'.shp '. $unique.".json";
exec($exec);
- $exec = 'zip -j '.$unique.'.zip '.$unique.'.shp '.$unique.'.dbf '.$unique.'.shx '.$unique.'.gfs '.$unique.'.gml '.$unique.'.prj ';
+ $exec = 'zip -j '.$unique.'.zip '.$unique.'.shp '.$unique.'.dbf '.$unique.'.shx '.$unique.'.gfs '.$unique.'.gml '.$unique.'.prj '.$unique.".json";
exec($exec);
- $exec = 'rm -f'.$unique.'.zip '.$unique.'.shp '.$unique.'.dbf '.$unique.'.shx '.$unique.'.gfs '.$unique.'.gml '.$unique.'.prj ';
- exec($exec);
+ //$exec = 'rm -f'.$unique.'.zip '.$unique.'.shp '.$unique.'.dbf '.$unique.'.shx '.$unique.'.gfs '.$unique.'.gml '.$unique.'.prj ';
+ //exec($exec);
return $unique;
}
@@ -219,9 +219,45 @@
die("Too many results, please restrict your search.");
}
$gmlFactory = new UniversalGmlFactory();
- $myGml = $gmlFactory->createFromXml($data, $wfsConf);
+
+ //TODO: The follwoning code is not nice but more stable - exchange it later with the code below!
+ $parser = xml_parser_create();
+ xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
+ xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+ xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,"UTF-8");
+ xml_parse_into_struct($parser,$data,$values,$tags);
+ $code = xml_get_error_code($parser);
+ xml_parser_free($parser);
+ if ($code) {
+ $line = xml_get_current_line_number($parser);
+ $mb_exception = new mb_exception(xml_error_string($code) . " in line " . $line);
+ }
+ function sepNameSpace($s){
+ $c = mb_strpos($s,":");
+ if($c>0){
+ return mb_substr($s,$c+1);
+ } else {
+ return $s;
+ }
+ }
+ $featureNameToUpper = mb_strtoupper($wfsGetFeatureAttr);
+ $featureValuesArray = array();
+ foreach ($values as $element) {
+ if(mb_strtoupper($element[tag]) == $featureNameToUpper || sepNameSpace(mb_strtoupper($element[tag])) == $featureNameToUpper){
+ array_push($featureValuesArray, $element[value]);
+ }
+ }
+ //$featureValues = join("|", $featureValuesArray);
+ $json = new Services_JSON();
+ echo $json->encode($featureValuesArray);
+
+ //TODO: use the following if php error in parsing xml is fixed - ubuntu 12.04 (2013.10.07 - has no problems!)
+ /*$myGml = $gmlFactory->createFromXml($data, $wfsConf);
if (!is_null($myGml)) {
+ echo $myGml;
+ die();
$geoJson = $myGml->toGeoJSON();
+ //echo $geoJson;
//parse attribute objects
$featureValuesArray = array();
$geoObj = json_decode($geoJson);
@@ -229,13 +265,13 @@
array_push($featureValuesArray, $feature->properties->{$wfsGetFeatureAttr});
}
$json = new Services_JSON();
- echo $json->encode($featureValuesArray);
+ echo $json->encode($featureValuesArray);
}
else {
$geoJson = "{}";
header("Content-type:application/x-json; charset=utf-8");
echo $geoJson;
- }
+ }*/
}
else {
echo "please enter a valid command.";
More information about the Mapbender_commits
mailing list