legend problems

Ken Lord kenlord at GMAIL.COM
Thu Apr 14 12:40:36 EDT 2005


Hi Ferencik,

Your map file appears to be missing a legend object, Its a block
similiar to the layer objects or web, reference, scalebar objects but
it sets up the layer including telling mapserver the name and location
of your legend template file, and whether the legend is On, Off, or
Embedded.

Within the mapfile documentation, the Legend object is described here:

http://mapserver.gis.umn.edu/doc44/mapfile-reference.html#legend

I use CGI mapserver, with HTML templates, using the [legend] tag, with
no need to set any 'mode=legend' value anywhere. The legend object of
the mapfile tells mapserver to process it when the map / scalebar /
reference image are generated.

Cheers,
Ken Lord
Vancouver BC


On 4/14/05, Bart van den Eijnden <BEN at syncera-itsolutions.nl> wrote:
> Hi,
> 
> if you are using PHP you need to call a function processLegendTemplate, see the PHP Mapscript docs.
> 
> If you are using Mapserver CGI, then you to use a mode=legend request to get the legend. See the Mapserver CGI docs.
> 
> Best regards,
> Bart
> 
> Bart van den Eijnden
> Syncera-ITSolutions
> Postbus 270
> 2600 AG  DELFT
> 
> tel.nr.: 015-7512436
> email: BEN at Syncera-ITSolutions.nl
> 
> >>> Ferencik Ioan <ferencik.ioan at PERSONAL.RO> 04/14/05 10:43am >>>
> I am a little bit confused
> 
> i have folowing map file
> MAP
>        NAME "rosia"
>        STATUS ON
>        SHAPEPATH "date"
>        SIZE 800 600
>        IMAGETYPE PNG24
>        IMAGECOLOR 255 255 255
>        EXTENT  319780 522564 385192 575568
>                PROJECTION
>                        "init=epsg:31700"
>                END
>        FONTSET "fonts/fonts.list"
>        SYMBOLSET "simbol/simbol.sym"
> 
>        REFERENCE
>                EXTENT  319780 522564 385192 575568
>                IMAGE "date/raster/dem.png"
>                SIZE 100 100
>                STATUS ON
>                COLOR -1 -1 -1
> 
>        END
>        LAYER
>                NAME "DEM"
>                DATA 'raster/demback.tif'
>                TYPE RASTER
>                        PROJECTION
>                                "init=epsg:31700"
>                        END
>                STATUS ON
>                GROUP "Base"
>        END
> 
>        LAYER
> 
>                NAME "Cadmium "
>                DATA xysediment04
>                TYPE POINT
>                        PROJECTION
>                                "init=epsg:31700"
>                        END
>                STATUS ON
>                CLASS
>                        NAME "Cadmium normal"
>                        COLOR 32 79 240 #albastru
>                        SYMBOL "star"
>                        EXPRESSION ([CD_114] < 1)
>                        SIZE 10
>                END
> 
>                CLASS
>                        NAME "Cadmium plus"
>                        COLOR 240 11 16 #rosu
>                        SYMBOL "star"
>                        EXPRESSION ([CD_114] > 1)
>                        SIZE 10
>                END
> 
>                METADATA
>                END
> 
>        END
> 
>        LAYER
> 
>                NAME "rivers"
>                DATA retea
>                TYPE LINE
>                LABELITEM "DENUMIRE"
>                        PROJECTION
>                                "init=epsg:31700"
>                        END
>                STATUS ON
>                GROUP "Base"
>                        CLASS
>                                COLOR 35 57 214
>                                NAME "riv"
>                                STYLE
>                                        SIZE 50
>                                        SYMBOL "line1"
>                                END
>                        LABEL
>                                ANGLE AUTO
>                                BUFFER 10
>                                COLOR 35 57 214
>                                FONT "times-italic"
>                                TYPE TRUETYPE
>                                SIZE 8
>                                OFFSET 5 5
>                        END
> 
>                        END
> 
>                METADATA
>                        order 1
>                END
> 
>        END
> 
>        LAYER
> 
>                NAME "aries"
>                DATA aries
>                TYPE LINE
> 
>                        PROJECTION
>                                "init=epsg:31700"
>                        END
>                STATUS ON
>                        CLASS
>                                COLOR 35 57 214
>                                NAME "ARIES"
>                                STYLE
>                                        SIZE 50
>                                        SYMBOL "line1"
>                                END
> 
>                        END
> 
>        END
> 
>        SCALEBAR
>                COLOR -1 -1 -1
>                SIZE 100 3
>                STYLE 1
> 
>                STATUS ON
>                IMAGECOLOR 255 255 255
>                INTERVALS 4
>                UNITS KILOMETERS
> 
>        END
>        LEGEND
>                IMAGECOLOR 255 255 255
>                OUTLINECOLOR 0 0 0
>                KEYSIZE 15 15
>                STATUS ON
>                LABEL
>                        TYPE BITMAP
>                        SIZE MEDIUM
>                        COLOR 0 0 89
>                END
> 
>                TEMPLATE "legenda.html"
>        END
>        WEB
>                TEMPLATE "rosia.html"
>                IMAGEPATH "/ms4w/tmp/ms_tmp/"
>                IMAGEURL "/ms_tmp/"
> 
>        END
> 
> END
> 
> and my legend.html looks like this:
> 
> [leg_group_html]
>   <tr>
>       <td colspan=3 bgcolor=#cccccc><b>[leg_group_name]</b></td>
>   </tr>
>   [/leg_group_html]
> 
>   [leg_layer_html order_metadata=order opt_flag=12]
>   <tr>
>       <td>
>           <input type=checkbox name="map_rivers_status"
>          value=1 [if name=layer_status oper=eq value=1]CHECKED[/if]>
>        </td>
>       <td colspan=2>
>           [leg_layer_name]
>       </td>
>   </tr >
>   [/leg_layer_html]
> 
>    i have accessed the legend in my template file with:
> 
> <font size=+1><b>Legenda</b></font><hr>[legend]<hr>
> 
> but I see the  [legend] text insted the legend
> 
> can somebody tell me where I am wrong?
> 
> thanks
> 
> _____________________________________________
> Cinefil?Castiga o excursie la Venetia
> http://www.cineplus.ro/concurs
> 


-- 
==============================
Ken Lord B.Sc., A.Dipl.T.H.
7488 Magnolia Terrace
Burnaby BC, V5E 4L1
604-777-2171
kenlord at gmail.com
kenlord at email.com
klord at bgcengineering.com



More information about the mapserver-users mailing list