Opened 23 years ago

Last modified 15 years ago

#26 new defect

[OGR] Legend keys are blank when using STYLEITEM AUTO

Reported by: dmorissette Owned by: dmorissette
Priority: high Milestone: 6.0 release
Component: OGR Support Version: 4.1
Severity: normal Keywords:
Cc: warmerdam

Description (last modified by dmorissette)

Reported by Matt Wilkie:

> Bug:
> 
> I notice when zooming in that the legend entries sometimes have
> blank keys. At first I though that might be because the feature
> is not visible in the viewable area. However zooming in excessively
> proves that not to be the case.
> 
> It doesn't happen with the other two tab demos, maybe because
> they use fewer tab files.
>

Change History (9)

comment:1 by dmorissette, 23 years ago

It's an annoying side-effect, but there isn't much we can do about it
due to the nature of the STYLEITEM AUTO feature.

The legend is draw after the map, and since the layers don't have a
static classification any more, the sample is based on the last feature
from the layer that was drawn with each class... the blanks key in some
cases are likely because no feature from that layer were drawn.

Now, that explains it, but doesn't solve the issue... since there can be
thousands of different colors and styles in a single TAB layer, we can't
do much except perhaps disabling the legend, or having the user specify
a small GIF image to be used as the legend key?  Any idea?

comment:2 by dmorissette, 21 years ago

Summary: Legend keys are blank when using STYLEITEM AUTO[OGR] Legend keys are blank when using STYLEITEM AUTO
Version: 3.53.7
Excerpt from a mapserver-users thread about this on 2003-01-03:

Oliver Wesp wrote:
> 
> I'm somwhat new to using MapInfo TABs with MapServer. So far I got
> everything up and running. My TABs contain different styles so I'm using
> StyleItem 'AUTO' to render these layers. Works fine except for the
> legend. I like every class to appear on the legend. Is this possible? An
> empty class section doesn't appear in the legend (lack of name-item).
> If I add NAME to my class section one class appears in the legend and
> is randomly rendered with different styles due to the displayed features
> when I zoom into the map.

Daniel Morissette wrote:
>
> ...
>
> I guess we could also modify MapServer so that if you define CLASS
> parameters (colors, etc.) in your layer then those parameters are saved
> and used for the legend icons instead of the current behavior where
> whatever you set in the CLASS object with STYLEITEM AUTO is simply
> ignored and the style of the last object takes precedence.
> 

comment:3 by dmorissette, 21 years ago

Version: 4.04.1
Can't be done in 4.0, maybe in 4.1.

comment:4 by dmorissette, 17 years ago

Description: modified (diff)
Milestone: 5.2 release

comment:5 by tamas, 17 years ago

I'm pretty interested in having a solution on this issue as soon as possible. This behaviour exists in many places out there and the actually rendered output seems to be run time determinated (depending on how the features have been drawn before) that is very frustrating. I bet the most prudent approach is to utilize the OGR datasource level default style as described in http://www.gdal.org/ogr/ogr_feature_style.html. And throw up with the practice to derive the symbology of the legend images from the feature style.

I would also interested in a solution to allow the override of the parameters of the auto style selectively from the mapfile or the mapscript interface.

comment:6 by dmorissette, 17 years ago

Note that the datasource-level style table and default style concepts were just ideas in this document and were never implemented in any driver. Even if we wanted to do it, I'm not sure how the TAB driver could provide a default style for a given .TAB dataset since the source file doesn't contain any info that could be used for that.

With respect to the override of parameters of the auto styles, that should be the topic of another ticket to avoid bloating this ticket with too many issues.

comment:7 by dmorissette, 17 years ago

Cc: warmerdam added

comment:8 by dmorissette, 16 years ago

Milestone: 5.2 release5.4 release

comment:9 by dmorissette, 15 years ago

Milestone: 5.4 release6.0 release
Note: See TracTickets for help on using tickets.