<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hi Stefanie,<br>
<br>
I recently finished something similar to your problem, that may or may
not be helpful. In our situation, we needed to accept a normal
incoming WMS request, and within that request, provide application
specific variables (similar to what you need to provide) which are then
substituted by mapserver to pull out the data dynamically.<br>
<br>
Mapserver can accept parameters following the standard WMS
specifications, as well as providing extra functionality via the
mapscript cgi interface. Our end result used a backend mapserver
(which published a layer of data drawn out of a postgis database), and
a front end pseudoWMS server. I wrote the pseudo WMS server as a
simple java servlet. The PseudoWMSServer acts as the WMS compliant
entry point to the mapserver, and as such *should* accept incoming
GetMap, and GetCapabilities requests. Clients make a request to this
WMS
server in a format something like this:<br>
<br>
request:
<a class="moz-txt-link-freetext"
href="http://www.refractions.net/PseudoWMSServer/PseudoWMSServer?request=GetMap&layers=layerName,variable1,variable2&etc">http://www.refractions.net/PseudoWMSServer/PseudoWMSServer?request=GetMap&layers=layerName,variable1,variable2&etc</a>.<br>
<br>
The PseudoWMSServer accepts this incoming request, parses it, and
creates a new request to the mapserver instance. This new request uses
the mapscript CGI interface to pass in the same request, along with the
variables. In our case, the new request made to the mapserver instance
looked like:<br>
<br>
mapserverURLStr =
<a class="moz-txt-link-freetext"
href="http://www.refractions.net/cgi-bin/mapserv&map=/pathToMapFile&MODE=MAP&MINX=1&MINY=1&MAXX=2&MAXY=2&MAPSIZE=640+480&LAYERS=layerName&variable1=variable1Value">http://www.refractions.net/cgi-bin/mapserv&map=/pathToMapFile&MODE=MAP&MINX=1&MINY=1&MAXX=2&MAXY=2&MAPSIZE=640+480&LAYERS=layerName&variable1=variable1Value</a><br>
<br>
In the mapserver instance's mapfile, we have a layer defined this way:<br>
<br>
LAYER<br>
NAME "layerName"<br>
TYPE LINE<br>
STATUS ON<br>
CONNECTIONTYPE postgis<br>
CONNECTION "host=hostname dbname=dbname user=username"<br>
DATA "the_geom from (SELECT * FROM tablename WHERE
blah=%variable1%)"<br>
<br>
etc..<br>
<br>
The PseudoWMSServer then opens up a stream to the mapserver, reads in
the bytes, and spits them back out through the waiting http
connection. Using this technique, you can maintain the use of WMS
specifications, as well as making use of mapserver's extra
functionality.<br>
<br>
Hopefully that helps. I have some kind lying around here, let me know
if you need any of it.<br>
<br>
--Adam<br>
<br>
<br>
Stefanie Weykam wrote:<br>
<blockquote cite="midLBEBIABPHLLJINHFPKLHIEPMCAAA.sweykam@teleline.es"
type="cite">
<pre wrap="">Hi list members,
A while ago I developed a very simple mapserver application which I would
now like to make available as WMS. I wonder if it is possible to modify the
class expressions via the WMS GetMap-request ?? Or can this only be done by
WFS?
You can see the application here at: <a
class="moz-txt-link-freetext" href="http://161.111.161.171/Atlas/">http://161.111.161.171/Atlas/</a>
It contains maps of 3 thematic groups (species distribution maps, maps on
biodiversity indices and environmental factors) and a query that allows to
generate a list of species, biodiversity indices and environmental factors
for each graticule.
The species distribution maps are what I would like to make available as web
map service but I can't figure out how to pass the parameter on that
indicates the species code.
The problem is the layer 'Dlyr', my species distribution layer.
As for the application, the user selects a species name from a list and this
variable is then used to render the map by modifying the predefined classes
in the map file.
$clObj0=$Dlyr->getClass(0);
$clObj0->setExpression('(['.$sp.']=0)');
$clObj1=$Dlyr->getClass(1);
$clObj1->setExpression('(['.$sp.']>0 AND ['.$sp.']<=20)');
$clObj2=$Dlyr->getClass(2);
$clObj2->setExpression('(['.$sp.']>20 AND ['.$sp.']<=40)');
$clObj3=$Dlyr->getClass(3);
$clObj3->setExpression('(['.$sp.']>40 AND ['.$sp.']<=60)');
$clObj4=$Dlyr->getClass(4);
$clObj4->setExpression('(['.$sp.']>60 AND ['.$sp.']<=80)');
$clObj5=$Dlyr->getClass(5);
$clObj5->setExpression('(['.$sp.']>80)');
The class ranges never change, no matter what species is selected.
The species code $sp identifies a column in a PostgreSQL table, i.e. [DEMI].
Each species has its table column.
I have already prepared a first version that you may try typing this in your
browser:
<a class="moz-txt-link-freetext"
href="http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&request=GetCapabili">http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&request=GetCapabili</a>
ties
You may retrieve a map composition, for example...
<a class="moz-txt-link-freetext"
href="http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&version=1.1.1&reque">http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&version=1.1.1&reque</a>
st=GetMap&layers=fondo,Dlyr,cuad50,cuad_anno&format=png&transparent
First, the client has to have as well a species list that allows to select
and pass on the species code (I will later make this list available). How is
the species identifier added to the request string ?
I guess, this calls for providing the layer as WFS instead (?). The client
then creates his own classes and I don't have to modify my code at all?
Is it possible to avoid that the whole data set is retrieved by a
GetFeature-request? I tried by specifying 'wfs_maxfeatures', but it had no
effect on the GetFeature response.
I am using MapServer 4.4 and this layer is a PostGIS table.
Thanks for your comments,
Stefanie Weykam
</pre>
</blockquote>
</body>
</html>