import mapnik
from mapnik import DatasourceCache as c
'raster' in c.plugin_names()
geoTiffFile = "out.tiff"
map = mapnik.Map(600,300)
#print "Map projection is :" + map.srs
map.background = mapnik.Color('white')
style = mapnik.Style()
rule = mapnik.Rule()
#RasterSymb = mapnik.RasterSymbolizer(mapnik.Color('#f2eff9')) # to fill a polygon we create a PolygonSymbolizer
#rule.symbols.append(RasterSymb)
style.rules.append(rule)
map.append_style('Map Style',style)
### To create datasource
for_area = mapnik.Gdal(base='/',file='out.tiff')
area=for_area.envelope()
print area
raster = mapnik.Raster(base='/',file='out.tiff',lox=area[0],loy=area[3],hix=area[1],hiy=area[2])
## To create layer: Mapnik Layers are basically containers around datasources
layer = mapnik.Layer('raster')
layer.datasource = raster
#print "Layer projection is : " + layer.srs
map.set_srs = layer.srs
#print "Map projection is :" + map.srs
layer.styles.append('Map Style')
map.layers.append(layer)
map.zoom_all()
mapnik.render_to_file(map,'/map.png', 'png')
print "image rendered ...!!"