Ruler

class visigoth.map_layers.ruler.Ruler(label='', decimal_places=2, stroke='black', stroke_width=2, font_height=16, text_attributes={})

Construct a map layer to display a ruler

Keyword Arguments:
 
  • label (str) – label for ruler
  • decimal_places (int) – the number of decimal places to display
  • stroke (str) – stroke colour for axis line
  • stroke_width (int) – width of axis line
  • font_height (int) – the font size in pixels
  • text_attributes (dict) – a dict containing SVG name/value pairs

Example

(Link to open example in new tab):

Source Code (Link to Github):

# -*- coding: utf-8 -*-

from visigoth import Diagram
from visigoth.containers import Map
from visigoth.map_layers import WMS, Ruler
from visigoth.containers.box import Box

d = Diagram(fill="white")

bounds = ((166.509144322, -46.641235447),(178.517093541, -34.4506617165))

m = Map(512,bounds,zoom_to=2)
m.addLayer(WMS())
m.addLayer(Ruler())
d.add(Box(m))

html = d.draw(format="html")

f = open("example.html", "w")
f.write(html)
f.close()