TYPE POINT layers must have symbols defined?

Ed McNierney ed at TOPOZONE.COM
Fri Dec 22 15:27:10 EST 2006


Steve -

I realized that I didn't quite answer your question.  Yes, the features
are getting to the cache; there are labels to be drawn and the first two
in this layer pass through OK and then this one fails.  Again, I need to
look at the code again but I suspect the first two are being rejected
earlier for other reasons so msGetMarkerSize never gets called for them.


	- Ed

P.S. Again, for clarification, this is happening in 4.10

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Ed McNierney
Sent: Friday, December 22, 2006 2:04 PM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] TYPE POINT layers must have symbols
defined?

Steve -

I have not had time to go back and finish debugging, but the failure is
definitely in msDrawLabelCache.  The layers are all drawn and when the
first label is to be drawn, the positioning code calls msGetMarkerSize,
which returns -1 and causes the whole effort to bail out.

     - Ed

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Steve Lime
Sent: Friday, December 22, 2006 1:51 PM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] TYPE POINT layers must have symbols
defined?

Are features from that layer even making it to the cache? I wouldn't
think so. Rendering should be fail before any labeling is tried.

Steve

>>> Ed McNierney <ed at topozone.com> 12/21/2006 9:07:13 AM >>>
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
> To: <MAPSERVER-DEV at LISTS.UMN.EDU>
> 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:
> 
> 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