[Mapserver-users] truetype symbol size in legend
Moritz Lennert
mlennert at club.worldonline.be
Tue Apr 27 07:05:11 PDT 2004
Eric Bridger said:
> On Tue, 2004-04-27 at 04:28, Moritz Lennert wrote:
>> Eric Bridger said:
>
>> > This is something of a hack also but you could create a separate layer
>> > just for displaying the legend. Remove the NAME from your CLASS above
>> > to prevent it from displaying in the legend.
>> >
>> > Create a new LAYER:
>> > NAME Cerclestt_legend
>> > STATUS DEFAULT
>> > TYPE POINT
>> > CLASS
>> > NAME "Symbole cercle TT"
>> > COLOR 255 0 0
>> > # circle name defined in symbol.sym file
>> > SYMBOL "circle"
>> > SIZE N
>> > END
>> >
>> > Set N to the size you want in pixels. You could also create a
>> TrueType
>> > "N" circle in your symbol.sym file and use that as your SYMBOL.
>> >
>>
>> Thank you, now I get a nice legend. However, it is visible all the time,
>> and would like to have it shown only when the corresponding layer is
>> visible. So, I've been experimenting with the REQUIRES command. However,
>> I
>> just can't seem to make it work. When I set STATUS to DEFAULT, the
>> legend
>> is always visible, when I set it to ON or OFF it is never visible, even
>> when the layer CerclesTT is visible...
>>
>> Any hints ?
>>
>> Here's my Layer definition:
>>
>> LAYER # Legende pour cercles truetype
>> NAME Cerclestt_legend
>> STATUS ON
>> REQUIRES "[Cerclestt]"
>> TYPE POINT
>> CLASS
>> NAME "3 travailleurs"
>> COLOR 255 0 0
>> SYMBOL "point_tt"
>> SIZE 30
>> END
>> END # Legende pour cercles truetype
>>
> You'll discover that with Mapserver there's always more than one way to
> get the job done.
>
That's the charm of opensource isn't it ? ;-)
>
> Alternatively, and perhaps most cleanly is to investigate the GROUP tag
> in your map file. Have both the layer and legend layer use the same
> group name. Then both would get turned on/off together. (I couldn't test
> this, not being set up to use templates.
>
This works beautifully and does seem to be the cleanest solution. I just
replaced the original layer's name ("Cerclestt") with the group name
('gcerclestt") and voilà !
Thanks a lot Eric !
Moritz
More information about the MapServer-users
mailing list