WMS GetMap-Request and class expressions

Stefanie Weykam sweykam at TELELINE.ES
Mon Oct 10 04:18:31 EDT 2005


Hi Adam and Bart and rest of the list,
Thank you so much for your suggestions - sounds really interesting. 

I have not yet decided whether I want to provide the species distribution
maps as WMS or WFS. On one hand WMS would make things easier for clients, on
the other hand WFS has a lot more to offer. In THIS case the data are freely
available but people are usually a bit more anxious about their data - so I
am interested in both ways. 

I have my application running as usual, but this is NOT the one that
receives requests from cascaded servers. For this purpose I have a second
mapfile (I guess this is what Adam calls a pseudoserver). It makes use of a
mapfile which is stripped down to the essential (no titles and no embedded
legend) and has all the necessary metadata to be requested by clients.

Anyway, for now the problem is how to tell which species (out of almost 200)
is to be shown. 
I was hoping that the variable that identifies the species could be send
somehow with the GetMap-request, like this:
..request=GetMap&layers=Dlyr&species=meap   (this is the common Bee eater)
or this way:
..request=GetMap&layers=Dlyr&meap   
But this is probably not understood, since the variable is not an expected
element in this request.

If I had a SQL statement with a filter I could perhaps use the Styled Layer
Descriptor, as Bart suggested. But in my case I have no WHERE clause,
instead I want to SELECT a determined column out of some 200 species
columns. I wish I could get the column using an alias (AS spec), then the 6
class expressions would always refer to the same alias (column) and had not
to be changed at all.
A sub-query like this: SELECT %variable% AS spec FROM species;
I tried this for to start with:
DATA  "the_geom from (select species.the_geom, species.chdp as spec from
species)"
But I get an error message (wrong subquery). I feel there must be more in
it, perhaps I am missing something?

So, I still needed to provide almost 200 SLD files, one for each species.
Even though the value ranges never change - the species identifier in the
class expression does.

Perhaps Adam's solution is a better way - use a servlet that receives the
GetMap request plus the variable that indicates the selected species and
then create a new instance using the CGI interface and change the mapfile
parameters via a URL (see MapServer CGI Reference). 

$sp is the variable we would receive from the client - for example 'demi'.
This is how class 3 would be changed:
&map_Dlyr_class_3_expression=(['.$sp.']>40 AND ['.$sp.']<=60)

We would generate a URL like this:
http://161.111.161.171/cgi-bin/AtlasAves.exe?layer=Dlyr&mode=map&map_Dlyr_cl
assitem=demi&map_Dlyr_class_1_expression=([demi]>0%20AND%20[demi]<=20)&map_D
lyr_class_2_expression=([demi]>20%20AND%20[demi]<=40)%20&map_Dlyr_class_3_ex
pression=([demi]>40%20AND%20[demi]<=60)&map_Dlyr_class_4_expression=([demi]>
60%20AND%20[demi]<=80)&map_Dlyr_class_5_expression=([demi]>80%20AND%20[demi]
<=100)

Now I get curious how Adam makes his pseudoserver behave like a mediator,
parse the incoming request, send the URL and return the result to the
client. I have not yet configured my system for servlets, but If you don't
mind, Adam, yes I would like to see such an example.

Thanks for your comments,
Stefanie



More information about the mapserver-users mailing list