[mapserver-dev] Labeling Highway Shields Idea

thomas bonfort thomas.bonfort at camptocamp.com
Fri Jun 5 10:33:55 EDT 2009


Steve,

I like the idea, and think that the style bloc should also be used to  
render the label background in the simple case (thus deprecating the  
need for backgroundcolor, backgroundshadowcolor, offsets, etc...). The  
base object passed to the style rendering funbction would be the  
shapeboj representing the label's bounding box. This rectanlge can  
either be rendered normally in the case of a label background, or by  
using the GEOMTRANSFORM centroid can be used to render shields.

regards,

thomas

On May 21, 2009, at 23:50 , Stephen Woodbridge wrote:

> Hi all,
>
> Currently, unless I'm out of date, if you want to place highway  
> shields that are symbols as part of a label you have to use an  
> annotation layer to place the shield as a symbol(s) and the label  
> over top of that with the number.
>
> So this requires, two passes over the data, one to render the  
> highways and a second pass over the data to place the shields. It  
> also requires defining and maintaining two layers in place of one.
>
> A proposal for an alternate way:
>
> One way to do this would be to allow STYLE block(s) to be placed in  
> the LABEL block and these would use the base label point and be  
> rendered before the label text and only if the label test is  
> rendered. I say base label point, because you would still want to be  
> able to use OFFSET x y to align the label text with the shield  
> symbols. I suppose you could allow OFFSET x y in the STYLE block to  
> allow separate positioning of the symbols and to get multiple  
> symbols to align correctly with one another.
>
> The following is an example of how this might look. Sorry, I copied  
> it from the cpp input file but it should be easy to understand.  
> _label(font,size,color) is a macro simplify the files. If  
> USE_SHIELDS is defined it would use the proposal above and render  
> the interstate shields which is actually three symbols representing  
> the red, white and blue parts of the shield where each is a vector  
> symbol or you could have one STYLE block that uses an image symbol  
> for the shield. If USE_SHIELDS is not defined then you would get a  
> OSM style highway label in a box, like "[I-290]".
>
> Thoughts on this?
>
> If people think this would be a good enhancement, I would be happy  
> to write up a ticket for it.
>
> Thanks,
>  -Steve
>
>    CLASS ## Interstate
>      EXPRESSION "1"
>      STYLE
>        WIDTH _motorway_width
>        OUTLINEWIDTH 1
>        OUTLINECOLOR _motorway_ol_clr
>        MINWIDTH _motorway_minwidth
>        MAXWIDTH _motorway_maxwidth
>      END
>      STYLE
>        WIDTH _motorway_width
>        COLOR _motorway_clr
>        MINWIDTH _motorway_minwidth
>        MAXWIDTH _motorway_maxwidth
>      END
> #ifdef USE_SHIELDS
>      LABEL
>        MAXSCALEDENOM 3000000
>        STYLE
>          SYMBOL "interstate-red"
>          COLOR _red_clr
>        END
>        STYLE
>          SYMBOL "interstate-blue"
>          COLOR _blue_clr
>        END
>        STYLE
>          SYMBOL "interstate-white"
>          COLOR _white_clr
>        END
>        _label("arial-bold",10,_white_clr)
>        PRIORITY 1
>        MINSIZE 8
>        MAXSIZE 8
>        MINDISTANCE 150
>      END
> #else
>      LABEL
>        MAXSCALEDENOM 3000000
>        _label("arial-bold",10,_white_clr)
>        PRIORITY 1
>        MINSIZE 8
>        MAXSIZE 8
>        MINDISTANCE 150
>        MAXLENGTH 6
>        BACKGROUNDCOLOR _motorway_lbl_bg_clr
>        BACKGROUNDSHADOWCOLOR _motorway_lbl_shadow_clr
>      END
> #endif
>    END
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev



More information about the mapserver-dev mailing list