WMS

class visigoth.map_layers.wms.WMS(type='satellite', image='jpeg')

Create a WMS plot

Keyword Arguments
  • type (str) – satellite or osm

  • image (str) – type of image, for example “jpeg”, “png”

Example

Screenshot (Link to open SVG for interactive features):

../_images/example36.png

Source Code (Link to Github):


import os.path
import sys
import argparse
import random

from visigoth import Diagram
from visigoth.containers.map import Map
from visigoth.map_layers.wms  import WMS
from visigoth.utils.mapping import Mapping
from visigoth.containers.box import Box
from visigoth.common.text import Text


if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument("--outpath", help="path for output SVG", default="example.svg")
    args = parser.parse_args()

    d = Diagram(fill="white")

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

    d.add(Text("openstreetmap layer"))
    m1 = Map(512,bounds,zoom_to=3)
    m1.addLayer(WMS("osm"))
    d.add(Box(m1))

    d.add(Text("sentinel2 cloudless layer"))
    m2 = Map(512,bounds,zoom_to=3)
    m2.addLayer(WMS("satellite"))
    d.add(Box(m2))

    svg = d.draw()

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