VectorLayer used to mask an ImageCollection¶

Example to use a VectorLayer instance to mask a single country of an ImageCollection

In [ ]:
map = Map()
map

Create the Core003 ImageProcess object

In [ ]:
p03 = inter.ImageCollection("C03").process()

Create the VectorLayer object from the nuts1 data, remove all symbology rules, add a rule to display a single country

In [ ]:
v = inter.VectorLayer("nuts1").opacity(128)

v.remove('default','all')

country = "[ICC] = 'DE'"
v.set('default',country,'poly','fill','#ff000055')

Mask the Core003 ImageProcess object with the processing element created from the filtered VectorLayer

In [ ]:
pv = v.process()
p03 = p03.mask(pv)

Add the masked Core003 processing chain to the map

In [ ]:
map.clear()
tlayer = map.addLayer(p03.toLayer())

The same example for a DEM and another country

In [ ]:
map = Map()
map
In [ ]:
pDEM = inter.ImageCollection("DEM").process()
pDEM.parameter("source","EUDEM")
pDEM.parameter("mode","hillshade")
pDEM.scale(0,1500)
colors = ["#FFFFAA", "#27A827", "#0B8040", "Yellow", "#FFBA03", "#9E1E02", "#6E280A", "#8A5E42", "White"]
pDEM.colorCustom(colors)

v = inter.VectorLayer("nuts1").opacity(128)
v.remove('default','all')
country = "[ICC] = 'IT'"
v.set('default',country,'poly','fill','#ff000055')

pv = v.process()
pDEM = pDEM.mask(pv)

map.clear()
tlayer = map.addLayer(pDEM.toLayer())
In [ ]: