Opened 15 years ago

Last modified 14 years ago

#3044 new enhancement

Improved labeling of Highway Shields

Reported by: woodbri Owned by: sdlime
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc:

Description

thomas bonfort wrote:
> 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

Change History (3)

in reply to:  description ; comment:1 by ziziphus, 15 years ago

Replying to woodbri:

thomas bonfort wrote:
> 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

THIS IS MUCH NEEDED SOLUTION FOR AN ONGOING PROBLEM. Even today I was attempting to find a better way to create highway symbols and thought that "SYMBOL" should work within a STYLE block inside of LABEL. But it does not! The recommendation above would be a great enhancement to MapServer.

in reply to:  1 comment:2 by ziziphus, 15 years ago

THIS IS MUCH NEEDED SOLUTION FOR AN ONGOING PROBLEM. Even today I was attempting to find a better way to create highway symbols and thought that "SYMBOL" should work within a STYLE block inside of LABEL. But it does not! The recommendation above would be a great enhancement to MapServer.

comment:3 by sdlime, 14 years ago

Milestone: 6.0 release
Note: See TracTickets for help on using tickets.