TYPE POINT layers must have symbols defined?

Ed McNierney ed at TOPOZONE.COM
Thu Dec 21 10:07:13 EST 2006

Steve & Steve -

Thanks for the comments.  Obviously, this layer was intended to function as
an ANNOTATION layer and should have been created as such from the beginning.

The problem in the code is the failure to obtain a valid size for the
marker, and your comments seem to suggest that while a default symbol is
created there is no default color and therefore no marker can be calculated.
That's fine but obviously adding a COLOR statement in the map file would be
a weird way to work around the problem.

I will work on the assumption that the real problem is that msGetMarkerSize
should be reporting a descriptive error if it is unable to calculate a
marker size due to the absence of a COLOR, so I can write up that bug with a
proposed fix.

     - Ed

> From: Steve Lime <Steve.Lime at DNR.STATE.MN.US>
> Reply-To: Steve Lime <Steve.Lime at DNR.STATE.MN.US>
> Date: Wed, 20 Dec 2006 21:47:26 -0600
> Subject: Re: [UMN_MAPSERVER-DEV] TYPE POINT layers must have symbols defined?
> 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:
>   TILEINDEX "US/Index/hwy_exits"
>     LABEL
>       COLOR 0 0 128
>       TYPE TrueType
>       FONT ArialItalic
>       SIZE 8
>     END
>   END
>   MAXSCALE 50000
>   LABELITEM "Name"
> 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