Ticket #26 (new defect)

Opened 7 years ago

Last modified 2 months ago

[OGR] Legend keys are blank when using STYLEITEM AUTO

Reported by: dmorissette Assigned to: dmorissette
Priority: high Milestone: 5.4 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

07/16/01 16:31:13 changed by dmorissette

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?

01/03/03 12:46:52 changed by dmorissette

  • version changed from 3.5 to 3.7.
  • summary changed from Legend keys are blank when using STYLEITEM AUTO to [OGR] Legend keys are blank when using STYLEITEM AUTO.
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.
> 

06/30/03 22:00:58 changed by dmorissette

  • version changed from 4.0 to 4.1.
Can't be done in 4.0, maybe in 4.1.

08/24/07 14:56:15 changed by dmorissette

  • description changed.
  • milestone set to 5.2 release.

08/24/07 19:21:45 changed by tamas

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.

08/25/07 08:57:57 changed by dmorissette

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.

08/25/07 08:58:17 changed by dmorissette

  • cc set to warmerdam.

06/18/08 13:01:15 changed by dmorissette

  • milestone changed from 5.2 release to 5.4 release.