Scalebar - afast/map_print GitHub Wiki

Place a scale bar on your map to provide a general idea of distances.

Currently we only support a "bar" scale bar with the following options:

  • unit Can be meters, km, miles or feet
  • position: {x: 40, y: 40} Where on the png/pdf to place the scalebar
  • size: {width: 200, height: 40} Size in pixels for the scale bar.
  • padding: {top: 0, right: 0, bottom: 0, left: 0} this allows to separate the border from the scale bar itself
  • bar_height how tall to draw the bar
  • background_color Color to use for the scale bar background, ImageMagick is used to anything it accepts including 'transparent', or hex.
  • background_opacity if you want the background color to include some transparency.
  • text_style styling options:
    • fill_color background color
    • color the text color.
    • font the font to use, make sure it is installed on your system.
    • pointsize the size of the text.
    • gravity Where on the box to align the text.

Example

scalebar: {
  unit: 'meters', # meters, km, miles, feet
  position: {x: 500, y: 550},
  size: {width: 200, height: 40},
  padding: {top: 5, right: 5, bottom: 5, left: 5},
  bar_height: 10,
  background_color: 'black',
  background_opacity: 0.4,
  text_style: {
    fill_color: '#ffffff',
    color: '#000000',
    font: 'Arial',
    pointsize: '16',
    gravity: 'NorthWest'
  }
}
⚠️ **GitHub.com Fallback** ⚠️