This shows how to programmatically turn on and off layers on a Mapnik map from python.
Then the map is rendered twice to show how only active layers are displayed.
Mapnik >= 2.2 and the python bindings
git clone https://gist.github.com/8364280.git mapnik-layer-example
cd mapnik-layer-example
python render.py
# then look at the images: you should see how one shows points and one shows lines