TYPE POINT layers must have symbols defined?

Steve Lime Steve.Lime at DNR.STATE.MN.US
Wed Dec 20 22:47:26 EST 2006


Hi Ed: I'll have to run a couple of simple tests to refresh my memory,
but I believe the minimum requirement for a POINT layer is a COLOR and
without that wierd things might well happen. I would think the code
bails in the drawing section without a color. All styles define a symbol
0 (single point, 1 pixel line or a solid fill). Basically for point
labeling to succeed you must draw something. It may have been that older
versions of MapServer defined a default color. I don't recall the reason
not to define a default color but I imagine it stems from the addition
of STYLES where often a user defines just an outline color.

Annotation layers don't require a marker but will consider it as part of
the label if it is present.

Label collision takes point markers already rendered on the map into
consideration when placing labels so as not to write text over the top
of an existing marker.

In summary, I'm pretty sure your layer definition is invalid- needs a
COLOR...

Sorry for any confusion.

Steve

>>> Ed McNierney <ed at TOPOZONE.COM> 12/20/06 9:10 PM >>>
Folks -

I just finished hunting down a most puzzling bug and I'd like to know
what the "right answer" is for correcting it.  The simple problem is
that a LAYER of TYPE POINT seems to require a symbol of some sort to be
defined.  I encountered this dusting off some old map files, and all I
can say is that this layer worked in 4.0 and fails in 4.10.  Note that
the CLASS object defines a label but no symbol:

LAYER
  NAME HWY_EXITS
  TYPE POINT
  STATUS OFF
  TILEINDEX "US/Index/hwy_exits"
  CLASS
    LABEL
      COLOR 0 0 128
      TYPE TrueType
      FONT ArialItalic
      SIZE 8
      ANTIALIAS TRUE
      POSITION CC
    END
  END
  MAXSCALE 50000
  LABELITEM "Name"
END

When the label cache is to be drawn, in mapgd.c, the function
msDrawLabelCacheGD tests the marker size; the comment on the first line
is telling, as there ISN'T a marker in this case:

    if((layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->numstyles >
0) || layerPtr->type == MS_LAYER_POINT) { /* there *is* a marker
*/

      /* TO DO: at the moment only checks the bottom style, perhaps
should check all of them */
      if(msGetMarkerSize(&map->symbolset, &(cachePtr->styles[0]),
&marker_width, &marker_height, layerPtr->scalefactor) != MS_SUCCESS)
        return(-1);

There is no marker defined for this layer, and the function returns -1,
causing the map drawing to fail but not returning any useful error
message that gives even a hint of the problem!

There isn't any good reason for this layer to be TYPE POINT, and
changing it to TYPE ANNOTATION makes the problem go away.  I'm trying to
figure out if this is a documentation/code checking issue (TYPE POINT
layers must have symbols defined) or a msDrawLabelCacheGD bug.  That is,
should this TYPE POINT layer definition be legal or not?  If I can get
some guidance I will set things afoot to spare the next poor sod from
being befuddled by this one.  Thanks!

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com



More information about the mapserver-dev mailing list