setting STYLE with CGI parameters

Brock Anderson banders at REFRACTIONS.NET
Fri Mar 31 19:39:46 EST 2006


You're right, we can't access STYLE directly from CGI parameters.  After 
some investigation I found a workaround:

Mapserver treats

CLASS
    COLOR
    OVERLAYOUTLINECOLOR
    OVERLAYSYMBOL 'circle'
    OVERLAYSIZE 3
END #class

...the like a synonymn for...

CLASS
    STYLE
        COLOR       
    END #style
    STYLE
       OUTLINECOLOR
       SYMBOL 'circle
       SIZE 3
    END #style
END #class

The OVERLAY elements are used to access the second style.  I can set 
outline width and outline color via CGI parameters with:

    &map_mylayer_class_overlaysize=3
    &map_mylayer_class_overlayoutlinecolor=3

Brock

Paul Ramsey wrote:

> Then my money is on: they did not update the CGI interface when they  
> added the STYLE concept to the object model.  Blarg!
>
> On 31-Mar-06, at 3:22 PM, Brock Anderson wrote:
>
>> Thanks Paul.
>>
>> Near the bottom of this page:
>>
>>    http://mapserver.gis.umn.edu/docs/reference/cgi/controls
>>
>> it says if there is only one class, then omit the index.  I  actually 
>> have the CGI parameters working to set outlinecolor  directly within 
>> the class.  I use a query string parameter like this:
>>
>>    &map_mylayer_class_outlinecolor=...
>>
>> I just can't seem to get into the STYLE elemen to set WIDTH.
>>
>> Brock
>>
>> Paul Ramsey wrote:
>>
>>> I think you have to enumerate all the unnameable elements for  
>>> which  there are potentially more than one entry. (Not sure if we  
>>> count from  0 or 1)
>>>
>>> &map_mylayer_class_0_style_0_width=3
>>>
>>> P
>>>
>>> On 31-Mar-06, at 2:57 PM, Brock Anderson wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am trying to use CGI parameters to dynamically set the WIDTH  
>>>> and  OUTLINECOLOR within a STYLE tag.  I've tried various formats  
>>>> for  the CGI parameters, including something like:
>>>>
>>>>    &map_mylayer_class_style_1_width=3
>>>>
>>>> ... but the parameters are being ignored.  Is it possible to use   
>>>> CGI parameters to set values within a STYLE element?  How?
>>>>
>>>> Brock
>>>>
>>>> I'm using Mapserver 4.6.2.  A piece of my map file:
>>>>
>>>> LAYER
>>>>  NAME "mylayer"
>>>>  CONNECTIONTYPE postgis
>>>>  CONNECTION "..."
>>>>  DATA "..."
>>>>
>>>>  CLASS
>>>>    EXPRESSION ([pop] > 5000)
>>>>    NAME "above 5000"
>>>>    STYLE
>>>>      COLOR 0 197 255
>>>>    END #end style
>>>>    STYLE
>>>>      OUTLINECOLOR 0 197 255
>>>>      WIDTH 5
>>>>    END #end style
>>>>  END #end class
>>>>
>>>>  TYPE polygon
>>>>  STATUS DEFAULT
>>>>  PROJECTION
>>>>    "init=epsg:4269"
>>>>  END #projection
>>>> END #LAYER
>>>
>>>
>>>
>>
>



More information about the mapserver-users mailing list