[mapserver-users] Forward time and other parameters to a layer defined as wms client

Trond Michelsen trondmm-mapserver+2017 at crusaders.no
Thu Aug 8 03:59:42 PDT 2019


On Thu, Aug 08, 2019 at 10:12:58AM +0000, Søren Laursen wrote:
> Right now I am hacking some code to get GetCapabilities to work in
> our client, because we need some information about the timespan in
> the layer, which mapserver is not forwarding or know any information
> about.

I've made an outputfilter that does the same thing :) 

But, you can do it with the regular mapfile, too. I'm using an include
file, so I don't need to rewrite the full mapfile repeatedly.

  METADATA
    "wms_title"  "Radar Nowcast"
    "wms_extent" "-790000 7540000 759000 9398000"
    "wms_srs"    "EPSG:3857 EPSG:3575 EPSG:4326 EPSG:32633 EPSG:32761 EPSG:25833 CRS:84"
    INCLUDE "/var/tmp/timeextent.txt"
  END

Then timeextent.txt looks like this:

--8<--
    "wms_dimensionlist"     "modeltime"
    "wms_modeltime_item"    "foo"
    "wms_modeltime_extent"  "2019-08-08T10:45:00Z"
    "wms_modeltime_default" "2019-08-08T10:45:00Z"
    "wms_modeltime_units"   "ISO8601"
    "wms_timeextent" "2019-08-08T10:45:00Z,2019-08-08T10:50:00Z,2019-08-08T10:55:00Z,2019-08-08T11:00:00Z,2019-08-08T11:05:00Z,2019-08-08T11:10:00Z,2019-08-08T11:15:00Z,2019-08-08T11:20:00Z,2019-08-08T11:25:00Z,2019-08-08T11:30:00Z,2019-08-08T11:35:00Z,2019-08-08T11:40:00Z,2019-08-08T11:45:00Z,2019-08-08T11:50:00Z,2019-08-08T11:55:00Z,2019-08-08T12:00:00Z,2019-08-08T12:05:00Z,2019-08-08T12:10:00Z,2019-08-08T12:15:00Z,2019-08-08T12:20:00Z,2019-08-08T12:25:00Z,2019-08-08T12:30:00Z,2019-08-08T12:35:00Z,2019-08-08T12:40:00Z"
--8<--


This results in this capabilities-output

--8<--
        <Dimension name="time" units="ISO8601" nearestValue="0">2019-08-08T10:45:00Z,2019-08-08T10:50:00Z,2019-08-08T10:55:00Z,2019-08-08T11:00:00Z,2019-08-08T11:05:00Z,2019-08-08T11:10:00Z,2019-08-08T11:15:00Z,2019-08-08T11:20:00Z,2019-08-08T11:25:00Z,2019-08-08T11:30:00Z,2019-08-08T11:35:00Z,2019-08-08T11:40:00Z,2019-08-08T11:45:00Z,2019-08-08T11:50:00Z,2019-08-08T11:55:00Z,2019-08-08T12:00:00Z,2019-08-08T12:05:00Z,2019-08-08T12:10:00Z,2019-08-08T12:15:00Z,2019-08-08T12:20:00Z,2019-08-08T12:25:00Z,2019-08-08T12:30:00Z,2019-08-08T12:35:00Z,2019-08-08T12:40:00Z</Dimension>
        <Dimension name="modeltime" units="ISO8601" default="2019-08-08T10:45:00Z" multipleValues="1" nearestValue="0">2019-08-08T10:45:00Z</Dimension>
--8<--

Just make sure replacing the old timeextent.txt is an atomic
operation. Otherwise you risk requests coming in just when you've
deleted the old, and before the new is in place. That will cause a 500
Internal Server Error.

-- 
Trond Michelsen


More information about the mapserver-users mailing list