Compass

class visigoth.map_layers.compass.Compass(radius=40, fill='lightgrey', stroke='black', stroke_width=2)

Create a compass layer showing the user device heading (if available on the user device)

Arguments:

Keyword Arguments:
 
  • radius (int) – radius of compass in pixels
  • fill (str) – fill colour
  • stroke (str) – stroke color for circumference of compass and text
  • stroke_width (int) – stroke width for circumference of compass

Notes:

Example

(Link to open example in new tab):

Source Code (Link to Github):

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

from visigoth.diagram import Diagram
from visigoth.containers import Map, Box
from visigoth.map_layers import WMS, Compass
from visigoth.common import Text

d = Diagram()

bounds  = ((-180,-70),(180,70))
m = Map(512,bounds)
m.addLayer(WMS())
m.addLayer(Compass())
d.add(Box(Text("Compass Test",text_attributes={"font-style":"italic"})))
d.add(Box(m))

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

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