[Mapserver-dev] Adding a Time extent to Mapserver

Steve Lime steve.lime at dnr.state.mn.us
Thu Jan 2 17:52:00 EST 2003

I like Dan's idea. It'd be real easy to implement for WMS and for the
CGI implementation. In fact the bulk of the code is there, just needs to
be applied to the DATA field (EXPRESSION, FILTER and CONNECTION already
support this via the CGI). Might need to generalize the variable
substitution beyond the CGI though. The definition of a default time
parameter is not done, easy to add though, just call it "time". The only
missing piece would be some code to ingest a date string and parse it
into components so that substitutions could be done. One would think
that code would exist though. Anyone seen such a beast?


Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155

>>> Daniel Morissette <morissette at dmsolutions.ca> 12/30/02 02:10PM >>>
Hi David,

Your suggestion is a good start and would work for several cases, but
you want to represent 50 years of monthly data then you would need 600
layers which is not practical in the current mapfile architecture.  We
also need to account for situations like what John H. reported in
another message where the data is all in a single file (or database
table) and the selection needs to be made using an attribute filter.

Maybe another potential approach would be to use the equivalent of
%variable% replacements (added by Steve in CONNECTION strings) in the
layer parameters, so let's say you receive a getMap request with
TIME=2002-12-27 for instance, the following variable replacements
be available (this is just an example, more could be added):

   %time%         -> "2002-12-27"
   %time-yyyy%    -> "2002"
   %time-mm%      -> "12"
   %time-dd%      -> "27"
   %time-yyyymmdd% -> "20021227"

Then your layer defn could look like this:

    DATA "temporal_data/%time-yyyy%/%time-mm%/mydata"
Or if your data is all in the same table we could use something like

    DATA "temporal_data/mydata"
    FILTER "[StartDate] < '%time%' and [EndDate] > '%time%'"

This would require some special processing in mapwms.c to handle the
%variable% replacements, but could open lots of possibilities.  I'm
Steve would have some ideas too since he is the most familiar with the
mapfile parameters processing.  Let's see what he thinks.


David Graham wrote:
> Hello everyone:
> I just got in a request for serving up geospatial data with a
> nature.  Basically we would have the same data available for various
> time.  It would likely be served via WMS which does support temporal
> data.  The problem is that Mapserver is not set up to deal with it.
> In the WMS spec the getCapablilities reads:
> For a time range:
> <Extent name="time" default="2000">1990/2000/P1Y<Extent>
> For a single time:
> <Extent name="time" default="1998">1998</Extent>
> For a set of specific times:
> <Extent name="time"
> The getMap request contains a time attribute that can be set to set
> request for a certain time.
> So I have been thinking how to accomplish such a thing in mapserver
> a minimal amount of code change.
> I did come up with one senario that seemed like it would not break
> architecture.  Here it is:
> - Add a wms_min_time and a wms_max_time metadata tag to each layer.
> - Add a wms_temporal_layer_name metadata tag to each layer.
> - Reconfigure the WMS capabilities document to present a single
> for each unique wms_temporal_layer_name found.   The time extent
> be calculated from the available wms_min_time and wms_max_time
> for every mapserver layer contained in the wms_tempral_layer_name
> - i.e. group the mapserver layers together to represent the same
> across the temporal dimension.
> - Reconfigure getMap such that if the layer attribute passed by the
> client is a wms_temporal_layer_name it will then use the time
> to look up exactly which mapserver layer is applicable.
> Now this is one suggestion.  I am looking for other suggestions.  I
> that Daniel developed most of the code for the WMS so I would enjoy
> hearing his take on issue.
> Dave
> --
> David W. Graham
> Director of Geospatial Applications Development
> information integration and imaging, LLC
> 201 Linden St, Third Floor
> Fort Collins, CO 80524
> (970) 482-4400
> dgraham at i3.com 
> http://www.i3.com 

Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu 

More information about the mapserver-dev mailing list