AW: [UMN_MAPSERVER-USERS] Logical Expressions
Armin Burger
armin.burger at GMX.NET
Sat Nov 18 04:37:56 PST 2006
Jukka
for having real flexibility with WMS I would recommend using a small PHP
(or Python, Ruby, etc) script with the OWS request functions available
since version 4.10. You can virtually change everything, some parts are
straightforward to do, some parts would need a bit more efforts.
Adding additional parameters to the resource URL is always possible and
compliant with the specifications of WMS. Depending on that parameter
(e.g. user key, service name) one can select the required map file,
modify parameters in it, and so forth. This allows also to modify the
"wms_connectionstring" based on the input parameter, and hence the
corresponding tag in the capabilities XML. This way the additional URL
key from the request will always be in the capabilities returned without
having to write it statically in the map file.
A bit more work, and only needed in special cases, would be to apply an
XSLT filter on the getCapabilities XML before sending it back to the
client containing the information one would like to have. This could
overcome some annoying behaviours of Mapserver with regard to
layers/groups. It would allow to specify them in the way one would like.
Or also to just present the layers that one would like, without having
to create an additional map file for that (unfortunately one cannot
delete layers of a map object with Mapscript).
Best regards
Armin
Rahkonen Jukka wrote:
> ________________________________
>
>> Lähettäjä: UMN MapServer Users List puolesta: Arnd Wippermann
>> Hello Eric,
>> You can change values in the mapfile, when you use substitutions:
>> Z.Bsp.: EXPRESSION ('[PRJNR]' = '%PRJNR%') in the mapfile
>> And this in the Mapserver-Request (not WMS-Request)
>> ?mode=map&....&PRJNR=1001&...
>> Than Mapserver sustitute %PRJNR% with the value 1001.
>
> Hi,
>
> Just a comment, actually you CAN use substitutions also in WMS-requests if you just get your WMS-client to send them through to Mapserver. I made once a trial by using a variable as a part of the layer's database connection string and as a result I got a dynamic WMS layer with data changing according to this parameter. This works fine if requests are sent directly from the client, for example a web browser. Some WMS-clients are simply using the same WMS connection string that is used for GetCapabilities as a part of the GetMap request, and with those it is possible to use own variables if they are just added as extra parameters to the URL used for connecting the server. However, this is not how WMS-clients should work. Instead they should use an URL returned by the GetCapabilities as "wms_connectionstring" for GetMap requests . I tried also to pass my variable inside the layers "wms_connectionstring" attribute in the METADATA section of the mapfile as well in order to
make the WMS layer flexibly queryable with any standard WMS client. This did not work if I wrote something like &DATA=%variable% there because %variable% will not be substituted with the value but remains as textstring. Perhaps variable substitution is not allowed everywhere in the mapfile, or?
>
> A question for developers: I suppose that playing with extra parameters is not exactly forbidden by the WMS standards, but perhaps it may be a bit too Mapserver specific. Would it be a nice feature or not to be able to use runtime expressions also with WMS? Perhaps it would need no other changes than allowing runtime substitutions also for METADATA elements, or at least "wms_connectionstring". Or is it already possible somehow?
>
> Regards,
>
> -Jukka Rahkonen-
>
>
More information about the MapServer-users
mailing list