Passing a variable in mapserver

Matthew Perry perrygeo at GMAIL.COM
Fri Jan 27 16:51:54 EST 2006


 You can attach arbitrary variables to the URL that requests the image:


Then in your mapfile you can set the FILTER item for your postgis
layer and reference that variable:

 FILTER "mycolumn = %myvar%"

This variable substition method only works on certain mapfile items
such as  FILTER and DATA but that should be sufficient to do a postgis

and here's the official docs


On 1/27/06, ruben rincon (sent by <lists at> wrote:
>  Hello... everybody
> I'm about to finish my final project but I've found myself with a problem I
> haven't been able to handle.
> I need to pass a variable to the map file in order to make a query using
> postgis but I've no idea how to do it.
> There's no information about it but I know it's possible.  I just want to
> know how to declare the variable in the map file and the html file.
> So if you know how to do it or have a clue write me to this mail
> rdrincon at
> rubenrincon27 at
> Thank you
> ________________________________
>  View this message in context: Passing a variable in mapserver
>  Sent from the Mapserver - User forum at

Matt Perry
perrygeo at

More information about the mapserver-users mailing list