Custom VectorLayer created from WKT geometries¶

How to create a Vectorlayer from strings in Well-Known-Text format

In [ ]:
map = Map()
map

Create a VectorLayer having name "wkt" and adding a polygonal geometry. Then remove default symbology and create a red fill with thick black boundary

In [ ]:
v = inter.VectorLayer("wkt").opacity(128)
v.geomAdd("POLYGON ((20 40, 0 45, 10 52, 30 52, 20 40))")

v.remove('default','all')
v.set('poly','fill','#ff0000')
v.set('line','stroke-width','5.0')

#v.printXML()
#v.printLayer()

map.clear()
tlayer = map.addLayer(v.toLayer())

Use the custom vector layer to mask an ImageCollection

In [ ]:
p03 = inter.ImageCollection("C03").process()
pv = v.process()
p03 = p03.mask(pv)
map.clear()
tlayer = map.addLayer(p03.toLayer())
In [ ]: