scale_bar Element
The scale_bar element defines a scale bar (to show how many kilometers or miles are represented by a distance marked on the bar) to be added to the map request, if the map has a known spatial reference system (SRS). You can specify a single display mode (Metric or US) or dual mode (both Metric and US). The <scale_bar> element has the following definition:
<!ELEMENT scale_bar >
<!ATTLIST scale_bar
mode (METRIC_MODE|US_MODE|DUAL_MODES) "METRIC_MODE"
position (SOUTH_WEST|SOUTH_EAST|SOUTH|NORTH|
NORTH_WEST|NORTH_EAST) "NORTH_EAST"
offset_y CDATA #implied
offset_y CDATA #implied
color1 CDATA #implied
color1_opacity CDATA #implied
color2 CDATA #implied
color2_opacity CDATA #implied
length_hint CDATA #implied
label_color CDATA #implied
label_font_family CDATA #implied
label_font_size CDATA #implied
label_halo_size CDATA #implied
label_position (TOP|BOTTOM) "TOP"
>
All <scale_bar> attributes are optional. mode specifies if the scale bar should be in metric or US mode, or in both modes. The default is METRIC_MODE.
position defines the relative location on the map to place the scale bar. The default is NORTH_EAST.
offset_x and offset_y define the X and Y values to offset the scale bar position from the map margin. The default value for each is 0.
color1, color1_opacity, color2, and color2_opacity define the colors to be used when rendering the scale bar. color1 and color2 have a default value for red, green, blue; color1_opacity has a default value of (0x44, 0x44, 0x44, 210); and color 2_opacity has a default value of (0xee, 0xee, 0xee, 210).
length_hint defines the preferred number of pixels to be used to render the scale bar. The default is approximately 17% of the map width.
label_color, label_font_family, label_font_size, and label_halo_size affect the scale bar text. The defaults are black color, Serif font family, 12pt font size, and no halo (0 halo size).
label_position defines the position of the text relative to the scale bar (TOP or BOTTOM). The default is TOP.
scale_bar Element defines a scale bar.
Example: Scale Bar
<scale_bar position="SOUTH_WEST"
mode="US_MODE"
color1="#ff0000"
color1_opacity="128"
color2="#00ffff"
label_font_family="Dialog"
label_font_size="15"
label_font_style="italic"
label_font_weight="bold"
label_halo_size="2.8"
label_position="bottom"
offset_y="5" />