SCALEBAR

Scalebars currently do not make use of TrueType fonts. The size of the scalebar image is NOT known prior to rendering, so be careful not to hard-code width and height in the <IMG> tag in the template file. Future versions will make the image size available.

ALIGN [left|center|right]

New in version 5.2.

Defines how the scalebar is aligned within the scalebar image. Default is center. Available in versions 5.2 and higher.

BACKGROUNDCOLOR [r] [g] [b] | [hexadecimal string]

Color to use for scalebar background, not the image background.

  • r, g and b shall be integers [0..255]. To specify green, the following is used:

    BACKGROUNDCOLOR 0 255 0
    
  • hexadecimal string can be

    • RGB value: “#rrggbb”. To specify magenta, the following is used:

      BACKGROUNDCOLOR "#FF00FF"
      
    • RGBA value (adding translucence): “#rrggbbaa”. To specify a semi-translucent magenta, the following is used:

      BACKGROUNDCOLOR "#FF00FFCC"
      
COLOR [r] [g] [b] | [hexadecimal string]

Color to use for drawing all features if attribute tables are not used.

  • r, g and b shall be integers [0..255]. To specify green, the following is used:

    COLOR 0 255 0
    
  • hexadecimal string can be

    • RGB value: “#rrggbb”. To specify magenta, the following is used:

      COLOR "#FF00FF"
      
    • RGBA value (adding translucence): “#rrggbbaa”. To specify a semi-translucent magenta, the following is used:

      COLOR "#FF00FFCC"
      
IMAGECOLOR [r] [g] [b] | [hexadecimal string]

Color to initialize the scalebar with (i.e. background).

  • r, g and b shall be integers [0..255]. To specify green, the following is used:

    IMAGECOLOR 0 255 0
    
  • hexadecimal string can be

    • RGB value: “#rrggbb”. To specify magenta, the following is used:

      IMAGECOLOR "#FF00FF"
      
    • RGBA value (adding translucence): “#rrggbbaa”. To specify a semi-translucent magenta, the following is used:

      IMAGECOLOR "#FF00FFCC"
      
INTERLACE [true|false]

Deprecated since version 4.6.

Should output images be interlaced? Default is [on]. This keyword is now deprecated in favour of using the FORMATOPTION “INTERLACE=ON” line in the OUTPUTFORMAT declaration.

INTERVALS [integer]

Number of intervals to break the scalebar into. Default is 4. Minimum value is 1 and maximum is 100.

LABEL

Signals the start of a LABEL object.

OFFSET [x] [y]

New in version 7.2.

‘OFFSET’ moves the scalebar closer to the center of the map. Minimum value is -50 and maximum is 50.

Examples:

  • If POSITION is “LL” then “OFFSET 5 2” will shift the scalebar 2 pixels up and 5 pixels to the right.

  • If POSITION is “UR” then “OFFSET 5 2” will shift the scalebar 2 pixels down and 5 pixels to the left.

OUTLINECOLOR [r] [g] [b] | [hexadecimal string]

Color to use for outlining individual intervals. Set any component to -1 for no outline which is the default.

  • r, g and b shall be integers [0..255]. To specify green, the following is used:

    OUTLINECOLOR 0 255 0
    
  • hexadecimal string can be

    • RGB value: “#rrggbb”. To specify magenta, the following is used:

      OUTLINECOLOR "#FF00FF"
      
    • RGBA value (adding translucence): “#rrggbbaa”. To specify a semi-translucent magenta, the following is used:

      OUTLINECOLOR "#FF00FFCC"
      
POSITION [ul|uc|ur|ll|lc|lr]

Where to place an embedded scalebar in the image. Default is lr.

POSTLABELCACHE [true|false]

For use with embedded scalebars only. Tells the MapServer to embed the scalebar after all labels in the cache have been drawn. Default is false.

SIZE [x][y]

Size in pixels of the scalebar. Labeling is not taken into account. Minimum x (width) is 5 and minimum y (height) is 2. Maximum x (width) is 1000 and maximum y (height) is 100.

STATUS [on|off|embed]

Is the scalebar image to be created, and if so should it be embedded into the image? Default is off. (Please note that embedding scalebars require that you define a markerset. In essence the scalebar becomes a custom marker that is handled just like any other annotation.)

STYLE [integer]

Chooses the scalebar style. Valid styles are 0 and 1.

TRANSPARENT [on|off]

Deprecated since version 4.6.

Should the background color for the scalebar be transparent. This flag is now deprecated in favor of declaring transparency within OUTPUTFORMAT declarations. Default is off.

UNITS [feet|inches|kilometers|meters|miles|nauticalmiles]

Output scalebar units, default is miles. Used in conjunction with the map’s units to develop the actual graphic. Note that decimal degrees are not valid scalebar units. Nauticalmiles was added in MapServer 5.6.