[Mapbender-commits] r10125 - in trunk/mapbender: conf http/extensions/mobilemap2/scripts/netgis http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu May 16 07:16:38 PDT 2019
Author: armin11
Date: 2019-05-16 07:16:38 -0700 (Thu, 16 May 2019)
New Revision: 10125
Added:
trunk/mapbender/conf/mobilemap2.conf-dist
Modified:
trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js
trunk/mapbender/http/php/mod_exportWmc2Json.php
Log:
Alter conf handling for mobilemap2 client - some further things have to be done !
Added: trunk/mapbender/conf/mobilemap2.conf-dist
===================================================================
--- trunk/mapbender/conf/mobilemap2.conf-dist (rev 0)
+++ trunk/mapbender/conf/mobilemap2.conf-dist 2019-05-16 14:16:38 UTC (rev 10125)
@@ -0,0 +1,5 @@
+<?php
+//********************************************************************
+//configuration for mapbender mobilemap2
+$backgroundWms = array(913,914,915);
+?>
Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js 2019-05-16 09:54:35 UTC (rev 10124)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js 2019-05-16 14:16:38 UTC (rev 10125)
@@ -45,22 +45,32 @@
/** Service URLs (avoid proxies by setting to null or empty string). */
//URL_WMC_PROXY: "./scripts/proxy.php", //TODO: empty proxy to invoke from js client on same machine!!!
URL_WMC_PROXY: "",
- URL_WMC_REQUEST: "http://www.geoportal.rlp.de/mapbender/php/mod_exportWmc2Json.php",
+ //URL_WMC_REQUEST: "http://www.geoportal.rlp.de/mapbender/php/mod_exportWmc2Json.php",
+ //URL_WMC_REQUEST: "http://localhost/mapbender/php/mod_exportWmc2Json.php",
+ URL_WMC_REQUEST: "../../php/mod_exportWmc2Json.php",
+ //name of serverside conf file for mobilemap - will be used as parameter for mod_exportWmc2Json.php!
+ CONF_FILE_NAME: "mobilemap2",
//URL_LAYERS_PROXY: "./scripts/proxy.php",
URL_LAYERS_PROXY: "",
- URL_LAYERS_REQUEST: "http://www.geoportal.rlp.de/mapbender/extensions/mobilemap/mod_mapbender/search_proxy.php",
+ //URL_LAYERS_REQUEST: "http://www.geoportal.rlp.de/mapbender/extensions/mobilemap/mod_mapbender/search_proxy.php",
+ //URL_LAYERS_REQUEST: "http://localhost/mapbender/extensions/mobilemap/mod_mapbender/search_proxy.php",
+ URL_LAYERS_REQUEST: "../mobilemap/mod_mapbender/search_proxy.php",
- URL_SEARCH_PROXY: "./scripts/proxy.php",
- URL_SEARCH_REQUEST: "http://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php",
-
- //URL_BACKGROUND_HYBRID: "http://www.gdi-rp-dienste2.rlp.de/mapcache/tms/1.0.0/topplusbkg@UTM32",
- URL_BACKGROUND_HYBRID: "http://www.gdi-rp-dienste2.rlp.de/mapcache/tms/1.0.0/test@UTM32",
+ //URL_SEARCH_PROXY: "./scripts/proxy.php",
+ URL_SEARCH_PROXY: "",
+ //URL_SEARCH_REQUEST: "http://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php",
+ URL_SEARCH_REQUEST: "../../geoportal/gaz_geom_mobile.php",
+ //URL_BACKGROUND_HYBRID: "http://www.gdi-rp-dienste2.rlp.de/mapcache/tms/1.0.0/topplusbkg@UTM32",
+ URL_BACKGROUND_HYBRID: "http://www.gdi-rp-dienste2.rlp.de/mapcache/tms/1.0.0/test@UTM32",
URL_BACKGROUND_AERIAL: "http://geo4.service24.rlp.de/wms/dop_basis.fcgi",
URL_FEATURE_INFO_PROXY: "./scripts/proxy.php",
- URL_HEIGHT_PROXY: "./scripts/proxy.php",
- URL_HEIGHT_REQUEST: "http://www.geoportal.rlp.de/mapbender/extensions/mobilemap/query/rasterqueryWms.php?&lang=de" //"http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/dhm_query/dhm.map&" + "SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SERVICE=WMS&LAYERS=mydhm&QUERY_LAYERS=mydhm"
+ //URL_HEIGHT_PROXY: "./scripts/proxy.php",
+ URL_HEIGHT_PROXY: "",
+ //URL_HEIGHT_REQUEST: "http://www.geoportal.rlp.de/mapbender/extensions/mobilemap/query/rasterqueryWms.php?&lang=de" //"http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/dhm_query/dhm.map&" + "SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SERVICE=WMS&LAYERS=mydhm&QUERY_LAYERS=mydhm"
+ URL_HEIGHT_REQUEST: "../../extensions/mobilemap/query/rasterqueryWms.php?&lang=de"
+
};
Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js 2019-05-16 09:54:35 UTC (rev 10124)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js 2019-05-16 14:16:38 UTC (rev 10125)
@@ -62,7 +62,7 @@
netgis.events.call( netgis.events.LAYERS_LOADING, { loading: true } );
- var url = netgis.config.URL_WMC_REQUEST + "?wmc_id=" + id + "&epsg=" + netgis.config.MAP_PROJECTION.split( ":" )[ 1 ] + "&withHierarchy=1";
+ var url = netgis.config.URL_WMC_REQUEST + "?confFileName=" + netgis.config.CONF_FILE_NAME + "&wmc_id=" + id + "&epsg=" + netgis.config.MAP_PROJECTION.split( ":" )[ 1 ] + "&withHierarchy=1";
if ( netgis.config.URL_WMC_PROXY && netgis.config.URL_WMC_PROXY.length > 0 )
{
@@ -369,4 +369,4 @@
return iface;
}
-)();
\ No newline at end of file
+)();
Modified: trunk/mapbender/http/php/mod_exportWmc2Json.php
===================================================================
--- trunk/mapbender/http/php/mod_exportWmc2Json.php 2019-05-16 09:54:35 UTC (rev 10124)
+++ trunk/mapbender/http/php/mod_exportWmc2Json.php 2019-05-16 14:16:38 UTC (rev 10125)
@@ -15,7 +15,6 @@
#
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-require_once(dirname(__FILE__) . "/../../conf/mobilemap.conf");
$user = new User();
$admin = new administration();
$userId = $user->id;
@@ -24,6 +23,29 @@
$withHierarchy = false;
$overlayPath = MAPBENDER_PATH."/php/mod_GetPublishedData.php?outputFormat=kml&wmc_id=";
+//check for given mobilemap conf file as get parameter
+if (isset($_REQUEST["confFileName"]) & $_REQUEST["confFileName"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["confFileName"];
+ $pattern = '/^mobilemap[0-9]$/';
+ if (!preg_match($pattern,$testMatch)){
+ echo 'Parameter <b>confFileName</b> is not valid - mobilemap{int}!.<br/>';
+ die();
+ }
+ $confFileName = $testMatch;
+ $testMatch = NULL;
+ //check if file exists:
+ if (file_exists(dirname(__FILE__) . "/../../conf/".$confFileName.".conf")) {
+ require_once(dirname(__FILE__) . "/../../conf/".$confFileName.".conf");
+ } else {
+ echo 'Requested mobilemap conf file <b>confFileName</b> does not exist - please create one in mapbender/conf/ directory!<br/>';
+ die();
+ }
+} else {
+ echo "Mandatory parameter <b>confFileName</b> is not set or empty!";
+ die();
+}
+
//check for parameter wmc_id
if(!isset($_GET["wmc_id"])){
echo 'Error: wmc_id not requested<br>';
@@ -117,27 +139,27 @@
//define background layer
//define list of typical background layer ids
//use wms id because the layers can be pulled dynamically
-//background wms list
-if (!isset($backgroundWms)) {
- $backgroundWms = array(1819,1382,1635);
-}
+//example from conf file:
//$backgroundWms = array(1906,1382,1819);
$backgroundLayer = array();
-//get list of layers for this wms
-$v = array();
-$t = array();
-$sql = "SELECT layer_id FROM layer WHERE fkey_wms_id in ( ";
-for($i=0; $i<count($backgroundWms);$i++){
- if($i > 0){$sql .= ",";}
- $sql .= "$".($i + 1);
- array_push($v,$backgroundWms[$i]);
- array_push($t,'i');
+
+if (isset($backgroundWms) && is_array($backgroundWms)) {
+ //get list of layers for this wms
+ $v = array();
+ $t = array();
+ $sql = "SELECT layer_id FROM layer WHERE fkey_wms_id in ( ";
+ for($i=0; $i<count($backgroundWms);$i++){
+ if($i > 0){$sql .= ",";}
+ $sql .= "$".($i + 1);
+ array_push($v,$backgroundWms[$i]);
+ array_push($t,'i');
+ }
+ $sql .= ")";
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_assoc($res)){
+ $backgroundLayer[] = $row['layer_id'];
+ }
}
-$sql .= ")";
-$res = db_prep_query($sql,$v,$t);
-while($row = db_fetch_assoc($res)){
- $backgroundLayer[] = $row['layer_id'];
-}
//not needed if searchInterface is used!!
function getLayerNameGetMapUrlById() {
}
@@ -257,7 +279,7 @@
//
} else {
- $e = new mb_exception("php/mod_exportWmc2Json.php: no wmc found in session!");
+ $e = new mb_exception("php/mod_exportWmc2JsonV2.php: no wmc found in session!");
}
}
@@ -268,7 +290,7 @@
$wmcEPSG = preg_replace("/EPSG:/","", $row['srs']);
//overwrite wmc information with external given if own bbox is requested
if (isset($mb_myBBOXEpsg) && isset($mb_myBBOX)) {
- $e = new mb_notice("user given extent information found");
+ $e = new mb_notice("php/mod_exportWmc2JsonV2.php: user given extent information found");
//transform user defined bbox into bbox for mobile client
$wmcEPSG = $mb_myBBOXEpsg;
$bbox = explode(',',$mb_myBBOX);
@@ -294,7 +316,7 @@
}
//build object
//build background part
- $wmcObject->backGroundLayer[0]->serviceType = "WMTS";
+ /*$wmcObject->backGroundLayer[0]->serviceType = "WMTS";
$wmcObject->backGroundLayer[0]->name = "Hybrid";
$wmcObject->backGroundLayer[0]->url = "http://www.gdi-rp-dienste2.rlp.de/mapcache/wmts/";
$wmcObject->backGroundLayer[0]->layer = "test";
@@ -306,7 +328,7 @@
$wmcObject->backGroundLayer[1]->name = "Luftbild";
$wmcObject->backGroundLayer[1]->url = "http://geo4.service24.rlp.de/wms/dop40_geo4.fcgi?";
$wmcObject->backGroundLayer[1]->layers = "dop";
- $wmcObject->backGroundLayer[1]->format = "image/jpeg";
+ $wmcObject->backGroundLayer[1]->format = "image/jpeg";*/
if (isset($initBackGroundLayer)) {
$wmcObject->backGroundLayer = array();
More information about the Mapbender_commits
mailing list