Wms time
From MapbenderWiki
Contents |
RFC for adding WMS time extent support to Mapbender
OVERVIEW
WMS TIME (WMS-T) allows to integrate time-sensitive geodata in a Web Map Service. By adding a time parameter to the GetMap request, it is possible to choose specific time values and to display only the fitting data in your map (depending on the period of time given in the GetCapabilities document). Adding WMS Time implies only small modifications to the Mapfile (layer level) when using MapServer CGI.
For more information, go to MapServer Documentation for WMS Time (http://mapserver.org/ogc/wms_time.html) or to the offical OGC Web Map Service Implementation Specification (http://www.opengeospatial.org/standards/wms)
The goal is to integrate the WMS TIME functionality into the Mapbender framework. Administrators and users should be able to customize this functionality in order to perform individual time-sensitive analyses.
Example of a GetCapabilities XML document with WMS-T (extract, http://mapserver.org/ogc/wms_time.html)
<Layer queryable="0" opaque="0" cascaded="0">
...
<Dimension name="time" units="ISO8601"/>
<Extent name="time" default="2004-01-01 14:10:00" nearestValue="0">2004-01-01/2004-02-01</Extent>
</Layer>
Examples of corresponding GetMap requests (extracts)
...&time=2004-01-01/2004-02-01&...
...&time=2004-01-04/2004-01-24&...
...&time=2004-01-08&...
This document is not complete but it should provide a good starting point for the integration of WMS-T.
TECHNICAL SOLUTION (POSSIBLE IMPLEMENTATION)
1. enable Mapbender to submit a GetMap request with the TIME parameter (whole time period, value given in GetCapabilities document)
2. enable administrators to customize the time value in the GetMap (starting)request
3. enable users to customize the time value dynamically in the GetMap request
4. enable administrators to activate/deactivate the time functionality
5. integration of jQuery UI widgets like slider and datepicker for intuitive customization of time values by users and administrators
MODIFICATIONS TO THE SOURCE CODE
extend http/classes/class_wms.php
At first, the GetCapabilities document has to be checked for the integration of time values. If WMS Time is not included, nothing has to be done. Else, the corresponding tag in the XML file is the starting point for the WMS Time processing. The decisive line in the document has always the following form --> <Extent name="time" ...>VALUE</Extent>. This value has to be stored in the Mapbender database in the table "layer". The time extent is displayed among the other parameters when the WMS is loaded into Mapbender. With "gui_layer_timeextent", the time extent is ported to the GUI level.
* CreateObjFromXML (L243)
L655 >> function createObjFromXML($url)
$this->objLayer[cnt_layer]->layer_timeextent = $element[value];
* optimizeWMS (L676)
L741 >> function optimizeWMS()
$this->objLayer[$i]->gui_layer_timeextent = $this->objLayer[$i]->layer_timeextent;
* displayWMS (L806)
L832 >> function displayWMS()
$this->objLayer[$i]->layer_timeextent
* newLayer (L864)
L899 >> function newLayer ($currentLayer, $currentExtent)
layer_timeextent
gui_layer_timeextent
* createJsObjFromWMS (L950)
L1002 >> function createJsObjFromWMS_($parent=0)
$this->objLayer[$i]->layer_timeextent
$this->objLayer[$i]->gui_layer_timeextent
* createJsLayerObjFromWMS (L1050)
L1100 >> function createJsLayerObjFromWMS($parent=0, $layer_name)
$this->objLayer[$i]->layer_timeextent
$this->objLayer[$i]->gui_layer_timeextent
* writeObjInDB (L1148) --> (TABLE layer and gui_layer (L1181))
L1221 >> function insertLayer($I,$myWMS)
$sql .= (layer_timeextent)";
$sql .= ($12)";
L1236 >> function insertLayer($I,$myWMS)
$v = array($this->objLayer[$i]->layer_timeextent);
$t = array('s');
* updateLayer (L1255)
L1279 >> function updateLayer($i,$myWMS)
$sql .= "layer_timeextent = $10 ";
L1294 >> function updateLayer($i,$myWMS)
$v = array($this->objLayer[$i]->layer_timextent);
$t = array('s');
* createObjFromDB (L1790)
L1890 >> function createObjFromDB($gui_id,$wms_id)
$this->objLayer[$layer_cnt]->layer_timeextent
$this->objLayer[$layer_cnt]->gui_layer_timeextent
* createObjFromDBNoGui (L1952)
L2041 >> function createObjFromDBNoGui($wms_id)
$this->objLayer[$layer_cnt]->layer_timeextent
$this->objLayer[$layer_cnt]->gui_layer_timeextent
* class layer extends wms (L2205)
L2217 >> var $layer_timeextent;
* insertGuiLayer (L1324)
L1329 >> insertGuiLayer($i,$myWMS,$gui_id)
gui_layer_timeextent
* appendGuiLayer (L1346)
L1351 >> appendGuiLayer($i,$myWMS,$gui_id)
gui_layer_timeextent
* updateGuiLayer (L1623)
L1681 >> updateGuiLayer($i,$myWMS,$gui_id)
gui_layer_timeextent
extend Mapbender Database
Adding a new column into table "layer" for saving possible time period value(s) given in the GetCapabilities XML file. Also a corresponding column in table "gui_layer" is needed.
* add column in db scheme (Mapbender Database)
table layer --> layer_timeextent (character varying(50))
table gui_layer --> gui_layer_timeextent (character varying(50))
extend http/javascripts/wms.js
* wms_add_layer (L639)
L650/L672 >> function wms_add_layer(...)
layer_timeextent
gui_layer_timeextent
* wms_layer (L698)
L709 >> function wms_layer(...)
layer_timeextent
gui_layer_timeextent
L731 >> function wms_layer()
layer_timeextent
gui_layer_timeextent
extend http/javascripts/map_obj.js:
To integrate the time functionality in the map application, the existing GetMap request must be extended. It is the easiest way to put the time parameter at the end of the request, but in the end the position is not so important.
* GetMapUrl (L492)
L557 >> this.getMapUrl = function(ii)
if (currentWms.gui_layer_timeextent !== "")
url += "&TIME=" + currentWms.gui_layer_timeextent + "&";
}
extend http/php/mod_editGuiWms.php:
Beside the users also the administrators should be able to modify the time value in the GetMap request. This customization concerns only the first request which is performed when the application is loaded. Since there is only one time extent for a complete WMS, only a single input field is needed. It should be located at the WMS GUI settings. A blank field is ignored, else the new value is integrated into the GetMap request. The opportunity to deactivate the time functionality could also be helpful.
* additional input field * additional checkbox
extend http/classes/class_map.php:
* createFromJs (L252)
L325 >> public function createFromJs ($jsMapObject)
$newLayer->layer_timeextent = $currentLayer->layer_timeextent;
L342 >> public function createFromJs ($jsMapObject)
$newLayer->gui_layer_timeextent = $currentLayer->gui_layer_timeextent;
create gui element "timeextent" (new file http/javascripts/mod_timeextent.php)
A new gui element is needed in order to allow users to modify the time value in the GetMap request. In the most basic implementation, this gui element consists of an input field and a submit button. In that case, the user should be informed about the valid time extent (GetCapabilities XML file, stored in the database) and the syntax rules used in the GetMap request. The goal should be to integrate a more convenient interface since most "normal" users are not so familiar with the principles behind a Web Map Server. jQuery UI widgets like slider and datepicker are intuitiv, easy to use and prevent invalid operations. That solution needs an increasing analysis of the time extent value.
HINT: L123 -> current Line 123 (Mapbender 2.6, June 2009)
FILES AFFECTED
- http/classes/class_wms.php
- http/classes/class_map.php
- http/javascripts/wms.js
- http/php/map_obj.js
- http/php/mod_editGuiWms
- Mapbender Database
NEW FILES
- http/javascripts/mod_timeextent.php
