[Mapbender-commits] r10111 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Apr 18 07:44:40 PDT 2019
Author: armin11
Date: 2019-04-18 07:44:40 -0700 (Thu, 18 Apr 2019)
New Revision: 10111
Modified:
trunk/mapbender/http/classes/class_kml_ows.php
trunk/mapbender/http/classes/class_kml_parser_ows.php
trunk/mapbender/http/classes/class_kml_point.php
trunk/mapbender/http/php/mod_GetPublishedData.php
Log:
Some enhancement for digitized kml export from current session
Modified: trunk/mapbender/http/classes/class_kml_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_kml_ows.php 2019-04-18 11:21:01 UTC (rev 10110)
+++ trunk/mapbender/http/classes/class_kml_ows.php 2019-04-18 14:44:40 UTC (rev 10111)
@@ -586,11 +586,9 @@
*/
public function parseGeoJSON ($geoJSON) {
$this->kml = "";
-
if (!$this->storeInDb()) {
return false;
}
-
$parser = new KmlOwsParser();
$parser->parseGeoJSON($geoJSON, $this->id);
$e = new mb_notice("parsing finished...#placemarks: " . count($this->placemarkArray) . " (" . count($parser->placemarkArray) . ")");
Modified: trunk/mapbender/http/classes/class_kml_parser_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_kml_parser_ows.php 2019-04-18 11:21:01 UTC (rev 10110)
+++ trunk/mapbender/http/classes/class_kml_parser_ows.php 2019-04-18 14:44:40 UTC (rev 10111)
@@ -45,7 +45,7 @@
if ($geometryFromGeoJSON->crs->type == "EPSG" && $geometryFromGeoJSON->crs->properties->code) {
$epsg = $geometryFromGeoJSON->crs->properties->code;
}
- // create Placemarks
+ // create Placemarks for each feature object
for ($i = 0; $i < count($geometryFromGeoJSON->features); $i++) {
$e = new mb_notice("parsing plm #" . $i . "...length of placemarkArray: " . count($this->placemarkArray));
$feature = $geometryFromGeoJSON->features[$i];
@@ -54,7 +54,7 @@
$epsg = $feature->geometry->crs->properties->code;
}
if (!$epsg) {
- $e = new mb_exception("EPSG is not set defaults to 4326!");
+ $e = new mb_notice("EPSG is not set - defaults to 4326!");
//$currentGeometry = false;
$epsg = "4326";
}
@@ -151,6 +151,7 @@
}
}
}
+ unset($epsg); //used for each feature!
}
}
return true;
Modified: trunk/mapbender/http/classes/class_kml_point.php
===================================================================
--- trunk/mapbender/http/classes/class_kml_point.php 2019-04-18 11:21:01 UTC (rev 10110)
+++ trunk/mapbender/http/classes/class_kml_point.php 2019-04-18 14:44:40 UTC (rev 10111)
@@ -36,7 +36,6 @@
*/
public function __construct ($geometryString, $epsg) {
//TODO: parameter validation and exception handling
-
// KML 2.2
if (preg_match("/,/", $geometryString)) {
$aPoint = explode(",", $geometryString);
Modified: trunk/mapbender/http/php/mod_GetPublishedData.php
===================================================================
--- trunk/mapbender/http/php/mod_GetPublishedData.php 2019-04-18 11:21:01 UTC (rev 10110)
+++ trunk/mapbender/http/php/mod_GetPublishedData.php 2019-04-18 14:44:40 UTC (rev 10111)
@@ -419,14 +419,17 @@
}
return $mergedKml->mergeKMLDocuments($kmlArray);
} else {
+ //$kmlArray = array();
$kmlObj = new Kml();
$kmlObj->parseGeoJSON(json_encode($geoJson));
// create the json-file
$kmlFile = TMPDIR.'/myDataCollection-'.$fileUuid.'.kml';
+ $kmlString = $kmlObj->__toString();
// put the contents to the created file
- file_put_contents($kmlFile, $kmlObj->__toString());
+ file_put_contents($kmlFile, $kmlString);
// return the string
- return $kmlObj->__toString();
+ $fileString = file_get_contents(TMPDIR.'/myDataCollection-'.$fileUuid.'.kml');
+ return $fileString;
die;
}
die();
More information about the Mapbender_commits
mailing list