[mapserver-users] how to set LegendTemplate display color same like class in the mapfile?

elisabeth theresia dbee_kawai at yahoo.com
Tue Aug 24 23:50:55 EDT 2010


Hello all,
I have problem to display Legend into the Chameleon Framework? anyone can help? 
when i put legendtemplate in the web template, then trouble appearance (i sent 
the picture too: my_strangelegend.jpg). here the coding


initialize Legend in the Map
(Ina.map)
:
:
CONNECTIONTYPE POSTGIS
    CONNECTION "user=usr password=pass dbname=db host=localhost port=5432"
    DATA "the_geom FROM tbk_x USING UNIQUE kode"

CLASS
        NAME "xx"
        TEMPLATE "./webtemplate.html"
            EXPRESSION ([ljum_pkl]>=1000 and [ljum_pkl]<=2000) 
            STYLE
            COLOR 255 50 50
            OUTLINECOLOR 0 0 0
            WIDTH 2
            ANTIALIAS TRUE
            END#STYLE
        END #CLASS
        
        CLASS
        NAME "yy"
        TEMPLATE "./webtemplate.html"
            EXPRESSION ([ljum_pkl]>=2001 and [ljum_pkl]<=4000) 
            STYLE
            COLOR 100 200 100
            OUTLINECOLOR 0 0 0
            WIDTH 2
            ANTIALIAS TRUE
            END#STYLE
        END #CLASS

CONNECTIONTYPE POSTGIS
    CONNECTION "user=usr password=pass dbname=db host=localhost port=5432"
    DATA "the_geom FROM tbk_x USING UNIQUE kode"
CLASS
NAME "xx"
        TEMPLATE "./webtemplate.html"
            EXPRESSION ([ljum_pkl]>=1000 and [ljum_pkl]<=2000) 
            STYLE
            COLOR 255 50 50
            OUTLINECOLOR 0 0 0
            WIDTH 2
            ANTIALIAS TRUE
            END#STYLE
        END #CLASS
        
        CLASS
        NAME "yy"
        TEMPLATE "./webtemplate.html"
            EXPRESSION ([ljum_pkl]>=2001 and [ljum_pkl]<=4000) 
            STYLE
            COLOR 100 200 100
            OUTLINECOLOR 0 0 0
            WIDTH 2
            ANTIALIAS TRUE
            END#STYLE
        END #CLASS

LEGEND # BLOK LEGENDA
    IMAGECOLOR 255 255 204 # kuning Muda
    KEYSIZE 18 9
    KEYSPACING 3 5
    POSTLABELCACHE TRUE
    STATUS ON # template
    TRANSPARENT OFF
    LABEL # LABEL LEGENDA    
        TYPE TRUETYPE
        FONT arial
        COLOR 0 0 0
        SIZE 6
        ANTIALIAS TRUE
    END #LABEL
    TEMPLATE "./legend_template.html"

initialize Legend in the Web Template using Chameleon Framework 
(webtemplate.html)

 <body onLoad="CWC2OnLoadFunction()">
    
    <table border="3" cellpadding="1" cellspacing="1">
    <tbody>
    <tr>

    <td>~~~coding CWC2 ELSE bla...bla~~</td>
    <td>~~~coding CWC2 ELSE bla...bla~~</td>      

 <td valign="top">
         <img src="./images/sim_utara.gif"><br>
         <CWC2 TYPE="LegendTemplate"
                 VISIBLE="true"
                ENABLED="true"
                EMBEDDED="true"
                POPUPWIDTH="50"
                POPUPHEIGHT="25"                
                TEMPLATE="./legend_template.html"/>                
                </td>

    <td>~~~coding CWC2 ELSE bla...bla~~</td>
</tr>
</tbody>
</body>

legend_template.html

[leg_layer_html order=ascending opt_flag=15]

  
      <input type="checkbox" name="legendlayername[]" 
value="[leg_layer_name]"
    [if name=layer_status oper=eq  value=1]CHECKED[/if]
    [if name=layer_status oper=eq value=2]CHECKED[/if]>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <img src="[leg_icon width=22 height=18]" width="22" height="18">
    
    [leg_layer_name]
  
[/leg_layer_html]

how to display Legend with color like in map's class?

Thanks a lot all =)

-Theresia



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100824/a4c3223a/attachment.html


More information about the mapserver-users mailing list