[mapserver-users] WMS-T in WMS Client

Trond Michelsen trondmm-mapserver+2017 at crusaders.no
Thu Sep 14 05:59:56 PDT 2017


Yes, Mapserver does not pass the dimension parameters to a cascading
wms server. I've handled this by using a mod_perl handler to modify
the request before it reaches mapserver. My function looks something
like this:

sub setup_dimensions {
    my $q = shift;
    my @dims = grep /^(TIME|LEVEL|ELEVATION)$|^DIM_/i, $q->param;
    my $dimensions = join "&" => map { join "=", uc $_, $q->param($_) } @dims;
    $q->param(MS_DIMENSIONS => $dimensions);
}

($q is the query object, so this adds a parameter named MS_DIMENSIONS to the query string)

Then in the mapfile, I add this parameter to the connection string

  CONNECTION "https://ws.mapserver.transports.gouv.qc.ca/swtq?%MS_DIMENSIONS%&"

And a validation for the layer:

  VALIDATION
    'MS_DIMENSIONS'  '^.*$'
  END

A bit dirty, maybe, but it works. Obviously the validation regex would
be better if it actually validated the parameter, so if you only ever
get a time parameter, and it's always in YYYY-MM-DD format, you could
change the regex to this:

  VALIDATION
    'MS_DIMENSIONS'  '^TIME=(19[89][0-9]|[2-9][0-9][0-9][0-9])-(0[1-9]|1[0-2])-([0[1-9]|[12][0-9]|3[01])$'
  END


Oh, you could of course do this without the mod_perl module too, and
just pass TIME to the connection string, like this:

However, this will only work if the time parameter is in upper case in
the incoming request, but as the parameter names in WMS are case
insensitive, you have no guarantee that they will be that. If you make
the only client that's supposed to communicate with your wms server,
this might be good enough, though.

-- 
Trond Michelsen


On Wed, Sep 13, 2017 at 09:46:21AM -0700, pe_lord wrote:
> I try to cascade some public wms service in my local (dev). The public wms
> has wms-t capabilities. 
> 
> When I call this public  WMS
> <https://ws.mapserver.transports.gouv.qc.ca/swtq?service=wms&request=getcapabilities> 
> , on layer histo_stations_meteoroutieres. 
> 
> Here an example of  getfeatureinfo
> <https://ws.mapserver.transports.gouv.qc.ca/swtq?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=-9147720.13647237792611122,4465573.1755253542214632,-6539533.15300130378454924,7715117.61394833214581013&CRS=EPSG:3857&WIDTH=732&HEIGHT=912&LAYERS=histo_stations_meteoroutieres&STYLES=&FORMAT=image/png&QUERY_LAYERS=histo_stations_meteoroutieres&INFO_FORMAT=text/html&I=372&J=490&FEATURE_COUNT=100&TIME=20170526/20170601>  
> with a time filter.
> 
> When I use this layer as a wms client layer within mapserv, I'm unable to
> get a filtered result. Here my cascaded wms call.
> 
> call
> <http://1.1.1.1:8080/cgi-bin/swtq.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=-9147720.13647237792611122,4465573.1755253542214632,-6539533.15300130378454924,7715117.61394833214581013&CRS=EPSG:3857&WIDTH=732&HEIGHT=912&LAYERS=cascade_histo_stations_meteoroutieres&STYLES=&FORMAT=image/png&QUERY_LAYERS=cascade_histo_stations_meteoroutieres&INFO_FORMAT=text/html&I=372&J=490&FEATURE_COUNT=100&TIME=20170526/20170601>  
> 
> Here how I config Mapserver 7.0.4 
> 
> 
> LAYER
>   NAME "cascade_histo_stations_meteoroutieres"
>   TYPE RASTER
>   STATUS ON
>   CONNECTION "https://ws.mapserver.transports.gouv.qc.ca/swtq?"
>   CONNECTIONTYPE WMS
>   	PROJECTION
> 	"init=epsg:3857"
> 	END
>   TEMPLATE 'VOID'
>   
>   METADATA
>     "wms_title"          "Cascade sm"
>     "wms_name"            "histo_stations_meteoroutieres"
>     "wms_server_version"  "1.1.1"
>     "wms_format"          "image/png"
>     "wms_timeitem"            "YYYY-MM-DD"
>     "wms_timeextent"          "1980-01-01/2020-06-01"
>     "wms_timeitem"            "date_mesu"
>     "wms_timeformat"          "YYYY-MM-DD"
>   END
> END
> 
> 
> Am I missing something on my mapfile configuration?  Here my log with a
> debug 5 level. There is no param name TIME=...
> 
> [Wed Sep 13 16:41:13 2017].331455 HTTP: Starting to prepare HTTP requests.
> [Wed Sep 13 16:41:13 2017].331871 HTTP request: id=2,
> https://ws.mapserver.transports.gouv.qc.ca/swtq?LAYERS=histo_stations_meteoroutieres&REQUEST=GetFeatureInfo&SERVICE=WMS&FORMAT=image/png&STYLES=&HEIGHT=912&QUERY_LAYERS=histo_stations_meteoroutieres&VERSION=1.1.1&SRS=EPSG:3857&WIDTH=732&BBOX=-9145938.5879864,4467354.72401133,-6541314.70148728,7713336.06546235&TRANSPARENT=TRUE&FEATURE_COUNT=100&INFO_FORMAT=text%2Fhtml&X=372&EXCEPTIONS=application/vnd.ogc.se_xml&Y=490
> [Wed Sep 13 16:41:13 2017].331920 HTTP request: id=2,
> https://ws.mapserver.transports.gouv.qc.ca/swtq?LAYERS=histo_stations_meteoroutieres&REQUEST=GetLegendGraphic&SERVICE=WMS&FORMAT=image/png&STYLES=&QUERY_LAYERS=histo_stations_meteoroutieres&VERSION=1.1.1&SRS=EPSG:3857&TRANSPARENT=TRUE&SCALE=1.34668e+07&LAYER=histo_stations_meteoroutieres
> [Wed Sep 13 16:41:13 2017].331941 HTTP: Before download loop
> [Wed Sep 13 16:41:13 2017].668641 msHTTPWriteFct(id=2, 678 bytes)
> [Wed Sep 13 16:41:13 2017].711841 msHTTPWriteFct(id=2, 8094 bytes)
> [Wed Sep 13 16:41:13 2017].715295 msHTTPWriteFct(id=2, 7685 bytes)
> [Wed Sep 13 16:41:13 2017].715377 HTTP: After download loop
> [Wed Sep 13 16:41:13 2017].715398 msHTTPExecuteRequests() timing summary per
> layer (connect_time + time_to_first_packet + download_time = total_time in
> seconds)
> [Wed Sep 13 16:41:13 2017].715414 Layer 2: 0.108 + 0.272 + 0.111 = 0.491s
> [Wed Sep 13 16:41:13 2017].715442 Layer 2: 0.198 + 0.139 + 0.198 = 0.534s
> [Wed Sep 13 16:41:13 2017].756428 freeLayer(): freeing layer at
> 0xf4cd4f42b0.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/Mapserver-User-f4226646.html
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list