[Mapbender-commits] r9849 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 22 06:46:11 PST 2018
Author: armin11
Date: 2018-01-22 06:46:11 -0800 (Mon, 22 Jan 2018)
New Revision: 9849
Modified:
trunk/mapbender/http/php/mod_GetPublishedData.php
trunk/mapbender/http/php/mod_exportWmc2Json.php
Log:
Export public kml overlay to external client
Modified: trunk/mapbender/http/php/mod_GetPublishedData.php
===================================================================
--- trunk/mapbender/http/php/mod_GetPublishedData.php 2018-01-22 09:26:32 UTC (rev 9848)
+++ trunk/mapbender/http/php/mod_GetPublishedData.php 2018-01-22 14:46:11 UTC (rev 9849)
@@ -79,6 +79,7 @@
header('Content-Type: text/xml');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Content-Length: '.filesize($temp_kml));
+ header("Access-Control-Allow-Origin: *");
readfile($temp_kml);
exec(escapeshellcmd('rm '.$temp_kml));
die();
@@ -117,6 +118,7 @@
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
+ header("Access-Control-Allow-Origin: *");
//parse the geojson from the array
$geoJson = $kmls[0]["data"];
$dataFile = createFile($outputFormat, $geoJson, $fileUuid, 1);
Modified: trunk/mapbender/http/php/mod_exportWmc2Json.php
===================================================================
--- trunk/mapbender/http/php/mod_exportWmc2Json.php 2018-01-22 09:26:32 UTC (rev 9848)
+++ trunk/mapbender/http/php/mod_exportWmc2Json.php 2018-01-22 14:46:11 UTC (rev 9849)
@@ -22,6 +22,8 @@
$mb_myBBOX = null;
$mb_myBBOXEpsg = null;
$withHierarchy = false;
+$overlayPath = MAPBENDER_PATH."/php/mod_GetPublishedData.php?outputFormat=kml&wmc_id=";
+
//check for parameter wmc_id
if(!isset($_GET["wmc_id"])){
echo 'Error: wmc_id not requested<br>';
@@ -179,16 +181,18 @@
global $userId;
global $admin;
global $backgroundLayer;
+ global $initBackGroundLayer;
global $mb_myBBOXEpsg;
global $mb_myBBOX;
global $withHierarchy;
+ global $overlayPath;
//maybe faster to parse the xml itself and read the new layer_names and getmapurls directly
/* example reduced wmc json
{"wmc":{"id":"6","title":"Testwmc","bbox":"","timeStamp":"123123123"},"layerList":[{"internal":true,"currentFormat":"image/png","id":31452,"opacity":50},{"internal":"false","currentFormat":"image/jpeg","getMapUrl":"","layerTitle":"","layerName":"","layerAbstract":"","layerBbox":"","opacity":"50"}]}
*/
//geometryfromtext(((((((((((((((((((('POLYGON(('::text || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.maxx::text) || ' '::text) || layer_epsg.maxy::text) || ','::text) || layer_epsg.maxx::text) || ' '::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.minx::text) || ' '::text) || layer_epsg.miny::text) || '))'::text, 4326) AS the_geom, (((((layer_epsg.minx::text || ','::text) || layer_epsg.miny::text) || ','::text) || layer_epsg.maxx::text) || ','::text) || layer_epsg.maxy::text AS bbox
- $sql = "SELECT wmc_title, wmc_serial_id, wmc, wmc_timestamp, abstract, srs, minx, miny, maxx, maxy, srs from mb_user_wmc WHERE wmc_serial_id = $1;";
+ $sql = "SELECT wmc_title, wmc_serial_id, wmc, wmc_timestamp, abstract, srs, minx, miny, maxx, maxy, srs, wmc_has_local_data, wmc_local_data_public from mb_user_wmc WHERE wmc_serial_id = $1;";
$v = array($wmcId);
$t = array('i');
@@ -245,11 +249,23 @@
$wmcObject->backGroundLayer[1]->url = "http://geo4.service24.rlp.de/wms/dop40_geo4.fcgi?";
$wmcObject->backGroundLayer[1]->layers = "dop";
$wmcObject->backGroundLayer[1]->format = "image/jpeg";
-
+
+ if (isset($initBackGroundLayer)) {
+ $wmcObject->backGroundLayer = array();
+ foreach($initBackGroundLayer as $singleBackgroundLayer) {
+ $wmcObject->backGroundLayer[] = $singleBackgroundLayer;
+ }
+
+ }
//build wmc part
$wmcObject->wmc->id = $row['wmc_serial_id'];
$wmcObject->wmc->title = $row['wmc_title'];
$wmcObject->wmc->timeStamp = $row['wmc_timestamp'];
+ if ($row['wmc_local_data_public'] == '1' && $row['wmc_has_local_data'] == '1') {
+ $wmcObject->wmc->kmloverlay = $overlayPath.$row['wmc_serial_id'];
+ } else {
+ $wmcObject->wmc->kmloverlay = null;
+ }
//transform bbox to requested crs
//TODO
//check if special other crs is requested
More information about the Mapbender_commits
mailing list