[OpenLayers-Users] Pass parameters to mapfile
S.Reena
reena at indiamail.com
Mon Nov 10 03:17:43 EST 2008
Hi,
I tried as :
var quakes = new OpenLayers.Layer.WMS( "custom",
"http://gis.rtbi-iitm.in/cgi-bin/mapserv?",
{map:'/var/www/html/customisation/mapfile/tnroad.map',transparent:true},{isBaseLayer:false});
map.addLayer(quakes);
quakes.mergeNewParams({layers:'tnroad',userid:'2'});
But mergeNewParams is not taking any value other than defaults for map (like
in this case userid ). So %userid% is not replaced in
DATA "the_geom from ( select * from customised_poly AS f where f.subcat_id
IN (select subcat_id from subcat_info where maincat_id =0) AND
user_id=%userid% )AS foo1 USING UNIQUE gid"
Thanks,
Reena.
Arnd Wippermann wrote:
>
> Hi,
>
> If you have declared the variable user_id before mergeNewParams, it should
> also work.
>
> Because it is a Mapserver question, try and manipulate the request in the
> browser and see what MapServer returns. If you get the response, you want,
> then it is possible to get it also with OpenLayers.
>
> Arnd Wippermann
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von S.Reena
> Gesendet: Samstag, 8. November 2008 14:05
> An: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] Pass parameters to mapfile
>
>
> Hi,
>
> One issue remains still ..
>
> "http://gis.rtbi-iitm.in/cgi-bin/mapserv?map=/var/www/html/customisation/map
> file/customNR.map&userid=2"
>
> is working ok with
>
> DATA "the_geom from ( select * from customised_poly AS f where f.subcat_id
> IN (select subcat_id from subcat_info where maincat_id =0) AND
> user_id='%userid%' )AS foo1 USING UNIQUE gid"
>
> but is I want to pass a dynamic value( a variable user_id) instead of a
> number ( in this case 2) then its not happening .
>
> I am still trying with wms[5].mergeNewParams({userid:user_id}) but its not
> working yet
>
>
> Thanks,
> Reena.
>
>
>
>
> Arnd Wippermann wrote:
>>
>> You can try to add the param to the url
>>
>> "http://gis.rtbi-iitm.in/cgi-bin/mapserv?map=/var/www/html/customisati
>> on/map
>> file/customNR.map&userid=anID"
>>
>> and in the mapfile try user_id='%userid%'. In special cases it is
>> possible per cgi-parameter manipulate the mapfile. I don't no if this
>> case is one of them.
>>
>> Try the mapserver-list, because it is not an OpenLayers issue.
>>
>> To retrieve more than one layer with OpenLayers WMS you use
>>
>> {'layers' : 'NR_point,NR_polygon', 'transparent' : true, ... }, ...
>>
>> a comma-separatet list as christopher mentioned.
>>
>> Arnd Wippermann
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: users-bounces at openlayers.org
>> [mailto:users-bounces at openlayers.org] Im Auftrag von S.Reena
>> Gesendet: Freitag, 7. November 2008 10:39
>> An: users at openlayers.org
>> Betreff: [OpenLayers-Users] Pass parameters to mapfile
>>
>>
>> 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/c
>> ustomisation/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-tp20377405p20377405.h
>> tml Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Pass-parameters-to-mapfile-tp20377405p20395897.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/Pass-parameters-to-mapfile-tp20377405p20415933.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list