GPS

class visigoth.map_layers.gps.GPS(radius=20, fill='#FF000030', stroke='black', stroke_width=2)

Create a plot showing the user location (if known) with a pulsating circle

Arguments:

Keyword Arguments
  • radius (int) – radius of circle in pixels

  • fill (str) – fill colour

  • stroke (str) – stroke color for circumference of circles

  • stroke_width (int) – stroke width for circumference of circles

Notes:

Example

Screenshot (Link to open SVG for interactive features):

../_images/example28.png

Source Code (Link to Github):



import os.path
import sys
import argparse


from visigoth.diagram import Diagram
from visigoth.containers.map import Map
from visigoth.containers.box import Box
from visigoth.map_layers.gps import GPS
from visigoth.map_layers.wms import WMS
from visigoth.utils.mapping.projections import Projections
from visigoth.common.text import Text

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument("--outpath", help="path for output SVG", default="example.svg")
    parser.add_argument("--iterations", help="number of iterations to run", default=200,type=int)

    args = parser.parse_args()

    d = Diagram(fill="white")

    bounds  = ((-180,-70),(180,70))
    m = Map(512,bounds,projection=Projections.ESPG_3857,zoom_to=3)
    g = GPS()
    m.addLayer(WMS())
    m.addLayer(g)
    d.add(Box(Text("GPS Test",text_attributes={"font-style":"italic"})))
    d.add(Box(m))
    
    svg = d.draw()

    f = open(args.outpath, "wb")
    f.write(svg)
    f.close()