Subscribe
Subscribe to the GIS Tools mailing list, one of several low volume mailing lists alerting you to changes to this site.

Your email address:


 More Info
Scalebar Docs
· Introduction
· Selecting a Style
· Positioning the Scalebar
· Specifying Units
· Displaying the Scale As Text
· Controlling the Number of Intervals
· Text Attributes
· Scalebars With Multiple Units
· Adding a Wrapper to Your Scalebar
· The Scalebar Gallery
Downloads
Download the AML
Home Page | GIS Tools | Resume | Travel | Site Map
gis tools

Positioning the Scalebar

Although you can specify both a position and a size for the scalebar, it is not always possible to draw it with the exact dimensions specified. The scalebar AML will try to draw the scalebar as large as possible without going beyond the size specified on the command line while at the same time ensuring that it displays nice round numbers.

Scalebar Dimensions
This diagram shows the relationship between the scalebar size specified, the size it is drawn, and the "actual" sizes that are returned when the getsize option is specified.


To get better control over the placement of the scalebar, you can specify left, right, or center justification by setting the global variable .scalebar$justification to one of those values. If .scalebar$justification is not set, the scalebar will be drawn with left justification.

Left Position Point
With left justification the upper left corner of the scalebar will be positioned at xpos, ypos.
Center Position Point
Center justification will cause the upper center point to be positioned at xpos, ypos.
Right Position Point
With right justification, the upper right corner will be positioned at xpos, ypos.


Note that because the bar itself is the dominant feature of the scalebar, the size and position of units and numbers are not considered when calculating the position of the scalebar.

Calculating the Exact Size and Position
of the Drawn Scalebar

As discussed previously, the actual size of the scalebar and associated numbers and units is dependent on many factors, including unit and number styles, bar size, map scale, and so on. If you need to know exactly how big the scalebar will be drawn with a given set of parameters, run the scalebar AML with the getsize option. This will cause the scalebar program to calculate the exact size of the final scalebar graphic, including all associated text, in your current pageunits, as well as the coordinates of its centerpoint. These values are stored in the global variables .scalebar$actualsize and .scalebar$actualposition. Also, the width of the bar itself is stored in .scalebar$actualbarwidth. The actual height of the bar itself is not returned, as it is always drawn with the height specified on the command line.

These variables can then be used by your map generation AMLs to control the exact positioning of other elements relative to the scalebar, such as a box drawn around the scalebar.

Note that the scalebar will not be drawn if the getsize parameter is specified.

Top of page | Next: Specifying Units
Green Tea

Comments or questions to: