[mapserver-users] RE Dynamically extent and layer filter

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Fri May 30 09:30:21 PDT 2014


Begin with a simple validation until it works.  Is it working if you set 
VALIDATION
        id '.*'
END

If yes then the problem is in your regex. Make sure that ',' are accepted.
If not the problem is the FILTER or the parameter you pass. 

Also Is your ID an integer or text in postgis? I think it matters.
('%id%') this would send a string to pg. In this case try FILTER  "id" in 
('%id%'), otherwise try
FILTER  id in (%id%)

It is not an easy task (in my opinion) in mapserv to use expresion and 
filter
But have a look at this. there are several examples
http://mapserver.org/fr/mapfile/expressions.html#string-expressions-that-return-a-logical-value

Also in you MAPFILE set  debug 5 in the MAP block, and also in your layer 
block. You will have more info in your mapserver log.
steve




Dedy Fuadi <sampahe.fb3 at gmail.com> 
2014-05-30 12:17

A
Steve.Toutant at inspq.qc.ca
cc
mapserver-users at lists.osgeo.org
Objet
Re: RE [mapserver-users] Dynamically extent and layer filter








This is my mapfile part :
VALIDATION
'id' '^[0-9]{1}$'
END
FILTER  (id in ('%id%'))

and as your advice I set URL parameter like &id=1,4,8 but the map is not 
appears there.

When I opened debug, I found :
[Sat May 31 00:10:34 2014].758000 msEvalRegex(): Regular expression error. 
String failed expression test.
[Sat May 31 00:10:34 2014].758000 loadForm(): Web application error. 
Parameter 'id' value fails to validate.


On Fri, May 30, 2014 at 11:42 PM, <Steve.Toutant at inspq.qc.ca> wrote:

In your mapfile you could set FILTER "id in (%ID%)" . 
And in the url pass a string as parameter such as &id=1,4,8 
That would be a simple way 

Please post further question on mapserver list, so others can answer you, 
and the answers can help other people later 
thanks 
steve




Dedy Fuadi <sampahe.fb3 at gmail.com> 
2014-05-30 11:28 


A
Steve.Toutant at inspq.qc.ca 
cc

Objet
Re: RE [mapserver-users] Dynamically extent and layer filter










Hi Steve, 

Your advice is nicely work for me! :D 

But how to select more than one data from postgis by VALIDATION block? For 
example, I have a postgis table that have 20 data, then I wanto to select 
data 1,4,8, or else to display by customizing URL parameter. I set '%id%' 
as my variable at mapfile, I just can display one data like &id=1. 

Please for your help. 
Thank you. 


On Fri, May 30, 2014 at 8:30 PM, <Steve.Toutant at inspq.qc.ca> wrote: 

Hi 
What did you try and what happened? Something in the mapserver log. 
If I understand well you want to use run time substitution, if so here a 
link 
http://mapserver.org/cgi/runsub.html 

Make sure you have a VALIDATION block 
Steve 



Dedy Fuadi <sampahe.fb3 at gmail.com>@lists.osgeo.org 
Envoyé par : mapserver-users-bounces at lists.osgeo.org 
2014-05-30 06:52 


A
mapserver-users at lists.osgeo.org 
cc

Objet
[mapserver-users] Dynamically extent and layer filter












Hello friends, 

I just success applying filter data for postgis database on my mapfile, 
but I met problem when I was to try use dynamic variable for filter data 
and extent map like variable at php file. 

What should I do for solving this problem? Whether mapfile can be a 
dynamically file like php? 

Thank you, 
regards._______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users 








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140530/1ef6ea87/attachment.htm>


More information about the MapServer-users mailing list