WMS GetMap-Request and class expressions

Bart van den Eijnden bartvde at XS4ALL.NL
Fri Oct 7 13:39:18 EDT 2005


Stefanie,

you could use SLD to create dynamic classifications. Look at the Mapserver  
WMS SLD Howto.

Best regards,
Bart

On Fri, 07 Oct 2005 19:21:26 +0200, Adam Quiney <aquiney at REFRACTIONS.NET>  
wrote:

> Hi Stefanie,
>
> 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.
>
> 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:
>
> request:  
> http://www.refractions.net/PseudoWMSServer/PseudoWMSServer?request=GetMap&layers=layerName,variable1,variable2&etc.
>
> 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:
>
> mapserverURLStr =  
> 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
>
> In the mapserver instance's mapfile, we have a layer defined this way:
>
> LAYER
> NAME "layerName"
> TYPE LINE
> STATUS ON
> CONNECTIONTYPE postgis
> CONNECTION "host=hostname dbname=dbname user=username"
> DATA "the_geom from (SELECT * FROM tablename WHERE blah=%variable1%)"
>
> etc..
>
> 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.
>
> Hopefully that helps. I have some kind lying around here, let me know if  
> you
> need any of it.
>
> --Adam
>
>
> Stefanie Weykam wrote:
>
> 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: http://161.111.161.171/Atlas/
> 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:
> http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&request=GetCapabili
> ties
>
> You may retrieve a map composition, for example...
> http://161.111.161.171/cgi-bin/AtlasAves.exe?service=WMS&version=1.1.1&reque
> 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
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the mapserver-users mailing list