Opened 19 years ago

Last modified 18 years ago

#1147 assigned defect

symbol sizes wrong in legend

Reported by: bugzilla@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer CGI Version: 4.8
Severity: normal Keywords:
Cc:

Description

I have the following layer to define a 4 kilometers cross:

LAYER
   ...
   SIZEUNITS meters
   CLASS
     SYMBOL "cross"
     SIZE 4000
     COLOR 0 0 0
   END
END

When i get the legend of this layer (mapserver?mode=legend) i get an ugly legend
because the size of symbol "+" is too big.

If i try:

LAYER
   ...
   SIZEUNITS kilometers
   CLASS
     SYMBOL "cross"
     SIZE 4
     COLOR 0 0 0
   END
END

I get very small symbols on the legend.

How can i do to get symbols the right size?

Attachments (1)

legend.png (873 bytes ) - added by bugzilla@… 19 years ago.
Legend with giant symbols

Download all attachments as: .zip

Change History (7)

comment:1 by sdlime, 19 years ago

Resolution: invalid
Status: newclosed
Take this to mapserver-users for help, doesn't sound like a bug (yet). Marking
as INVALID...

Steve

by bugzilla@…, 19 years ago

Attachment: legend.png added

Legend with giant symbols

comment:2 by bugzilla@…, 19 years ago

Resolution: invalid
Status: closedreopened
I think it is a bug. LEGENG object doesn't take into account "SIZEUNITS" tag   
and it seems to assume "pixels" as unit.   
   
If a symbol size is bigger than KEYSIZE then i think it should be scaled down   
in order to fit into the symbol key box.   
   
I have attached an example of wrong legend.   
   
If you consider it wasn't a bug, please consider it a feature request.   
 
 

comment:3 by sdlime, 19 years ago

Ok, you've convinced me. Will have a look.

Steve

comment:4 by bugzilla@…, 18 years ago

Version: unspecified4.8
This bug is still alive in mapserver 4.8.2. Is this going to be fixed at any time?


comment:5 by sdlime, 18 years ago

Working on it again...

Steve

comment:6 by sdlime, 18 years ago

Cc: dmorissette@… added
Status: reopenedassigned
I think I got this one. The layer scalefactor used when map drawing was not
being computed (or used) when creating legend icons. I think that was
appropriate for layers with symbolscale set since the default size in any given
style is good to use in a legend. However, in the case of non-pixel sizeunits
there is no good default symbol size so we have to use whatever image dimentions
are available to us.

So, I did 2 things. In msDrawLegend we compute the layer scalefactor and in
msDrawLegendIcon we use that scalefactor in calls to the symbol renderer's.  The
default scalefactor is 1.0 (which is what was being passed previously) so this
should only have any effect in a case like Francisco's.

This will fix the full legend images and in most cases the legend icon creation,
but I suspect maptemplate.c still needs a check.

Francisco, can you try this in CVS HEAD and let me know if it works?

Steve
Note: See TracTickets for help on using tickets.