Home Forums Nazca Questions and Answers Mask layer management Reply To: Mask layer management


Dear Chenhui,

Yes there is a mask layer system in Nazca. You can either load layers from a csv file or add them in your script via add_layer(). A layer can be given a layer_name too, e.g.

import nazca as nd
nd.add_layer(name='my_layer', layer= (2, 5))
nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer='my_layer')

As of Nazca-0.5, released Feb 20 ’19, there are some useful updates:
The layers are no longer primarily organized in layers and datatypes, but by an ID. You can still call a layer as previously, however, you can now also have multiple names for the same (layer, datatype) combination without ambiguity. If you refer to a layer by number and it has multiple layer_names Nazca will issue a warning and ask you to use the unique layer_name instead.

import nazca as nd
nd.add_layer(name='my_layer1', layer= (2, 5))
nd.add_layer(name='my_layer2', layer= (2, 5))
nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer='my_layer1')
nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer=(2, 5)) # This will trigger a warning

# warning message:
WARNING: Non-unique layer identifier used: (2, 5).
Matching layer_names for (2, 5) are ['my_layer1', 'my_layer2'].
Continuing here with layer_name = 'my_layer1'.