artemp/tickets2issues — Issue #582: Ability to delete/remove styles on layers
Author: artemp
Created: 2011-10-11 15:26:09+00:00
State: open
Labels: Core_Library

Looks like in C++ we need to add a remove_style() method and in python add the ability to clear the list:

In python you can't delete all layers:
{{{
>>> from mapnik import *
>>> l = Layer('name')
>>> l.styles.append('a')
>>> l.styles = []
Traceback (most recent call last):
File "", line 1, in
AttributeError: can't set attribute
}}}

but you can remove layers by index (which you seemingly can't in C++):
{{{
>>> del l.styles[0]
>>> l.styles[0]
Traceback (most recent call last):
File "", line 1, in
IndexError: Index out of range
>>> len(l.styles)
0
}}}