[Mapserver-users] How to change Data Statement in mapfile on fly

Jan Hartmann j.l.h.hartmann at uva.nl
Mon May 10 11:25:57 EDT 2004

s.dege wrote:

> Hy all,
> I'm beginner with MAPSERVER, and read a lot of things in the
> archives to find out about my problem, and tried lots of things.
> Here is a part of my mapfile
>     CONNECTIONTYPE postgis
>     NAME tempconcentration
>     # Connect to a remote spatial database
>     CONNECTION "user=user dbname=dbname ..."
>     # Get the lines from the 'geom' column of the
> Concentration' table
>     DATA "geom_concentration from table"
> #     GROUP pm
>      TOLERANCE 10
>      MAXSCALE 2599999
> #      LABELITEM "stations"
> As you can see, I'm using Postgis to retrieve data.
> What I want to do is to change on fly the data statement
> ("table" to be exact), because the table is never the same and
> is created dynamically. I've tried lots of combination (using
> '%table%', forms,...) but nothing works.
> So if anybody managed to do this, Iwould appreciate his help.


The DATA statement cannot be changed on the fly, unless you define a 
DATAPATTERN in the mapfile. This is a security issue in MapServer 4. See:


under the word DATAPATTERN. When you define it, you can set DATA form 
the URL, e.g. http://../mapserv?map=...&map_layer_data=...


More information about the mapserver-users mailing list