[OpenLayers-Users] Pass parameters to mapfile

S.Reena reena at indiamail.com
Mon Nov 10 08:56:42 EST 2008


Thanks Bijoy...

It already worked for me as Gerben suggested :

 nres = new OpenLayers.Layer.WMS.Untiled(
                "Natural Resources",
"http://gis.rtbi-iitm.in/cgi-bin/mapserv?userid="+user_id +"&",
               
{map:'/var/www/html/customisation/mapfile/customNR.map',transparent:true},{layers:'NR_point,NR_polygon,NR_line'},
{isBaseLayer:false});
                map.addLayer(nres);
                

Regards,
Reena.




Bijoy wrote:
> 
> Reena,
> 
> As per my understanding, I assume you want to pass dynamic value in the
> URL.
> 
> Can you try defining like the way I have done below:-
> 
> wms[5] = new
> OpenLayers.Layer.WMS.Untiled("Customization","http://gis.rtbi-iitm.in/cgi-bi
> n/mapserv?map=/var/www/html/customisation/mapfile/customNR.map&userid="+
> user_id,{'layers':
> 'NR_point,NR_polygon,NR_line','transparent':"true"},{'isBaseLayer':false}
> );
> 
> Let me know if this solves, else go under OpenLayers.Layer.WMS.Untiled
> class
> and try and find out what URL is being passed. You might have to use the
> library files.
> 
> Thanks,
> With Regards,
> BIJOY K. ANUPAM
> 
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On
> Behalf Of S.Reena
> Sent: Monday, November 10, 2008 3:06 PM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Pass parameters to mapfile
> 
> 
> Hi,
> 
> I already tried with 
> 
>  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=2",{'layers':
> 'NR_point,NR_polygon,NR_line','transparent':"true"},{'isBaseLayer':false}
> );
> 
> It works fine with static value but not with dynamic values like
> userid=user_id...
> 
> I think you were trying to suggest this only and if not then plz let me
> correct myself...
> 
> Thanks,
> Reena.
> 
> 
> 
> 
> G. Tiemens wrote:
>> 
>> Hi,
>> 
>> Your mapserver url can be extended with this paramter.. Try:
>>    "http://yourserv/mapserv?userid=" + customuserid + "&"
>> 
>> 
>> Greets
>> Gerben
>> 
>> 
>> -----Oorspronkelijk bericht-----
>> Van: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
>> Namens S.Reena
>> Verzonden: Monday, November 10, 2008 9:18 AM
>> Aan: users at openlayers.org
>> Onderwerp: Re: [OpenLayers-Users] Pass parameters to mapfile
>> 
>> 
>> 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},{isB
> aseLayer: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/customisati
>>> on/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/customisat
>>>> i
>>>> 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.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-tp20377405p20415933.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
>> 
>> << Please read our E-mail Disclaimer at the Grontmij Corporate website >>
>> _______________________________________________
>> 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-tp20377405p20416691.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-tp20377405p20420403.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list