[MAPSERVER-USERS] Pass parameters to mapfile

thomas bonfort thomas.bonfort at gmail.com
Tue Nov 11 13:58:51 EST 2008


you'd use something like this:

* in your mapfile:
DATA "the_geom from ( select * from customised_point AS f where
user_id='%userid%' AND f.subcat_id IN (select subcat_id from subcat_info where
maincat_id =0))AS foo USING UNIQUE gid"

you can add a regular expression for validating the %userid% string
for your layer:
metadata
 userid_validation_pattern "[a-zA-Z]*"
end

* the the wms url should include a userid=foo in it:
wms[5] = new OpenLayers.Layer.WMS.Untiled("Customization",
"http://gis.rtbi-iitm.in/cgi-bin/mapserv?map=/var/www/html/customisation/mapfile/customNR.map"
{'layers': "NR_point",'transparent':"true", 'userid':'foo'},
{'isBaseLayer':false} );

note that openlayers capitalizes the url params, so you should
probably use %USERID% in your mapfile

cheers,
thomas


On Fri, Nov 7, 2008 at 11:07, S.Reena <reena at indiamail.com> wrote:
>
> I am using the following data in my mapfile
>
>  DATA "the_geom from ( select * from customised_point AS f where
> user_id='userid' AND f.subcat_id IN (select subcat_id from subcat_info where
> maincat_id =0))AS foo USING UNIQUE gid"
>
>
> I want the userid ( used in the above query) to be passed to map file at the
> time of layer creation something like this....
>
> wms[5] = new OpenLayers.Layer.WMS.Untiled(
>
> "Customization","http://gis.rtbi-iitm.in/cgi-bin/mapserv?map=/var/www/html/customisation/mapfile/customNR.map"
> + userid  ,{'layers': "NR_point",'transparent':"true"},{'layers':
> "NR_polygon",'transparent':"true"},{'isBaseLayer':false} );
>
> How to do that?
>
> Thanks in advance :)
>
> Cheers,
> Reena.
> --
> View this message in context: http://www.nabble.com/Pass-parameters-to-mapfile-tp20377760p20377760.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


More information about the mapserver-users mailing list