Skip to content

Instantly share code, notes, and snippets.

View edigiacomo's full-sized avatar

Emanuele Di Giacomo edigiacomo

  • ARPAE-SIMC
  • Italy
View GitHub Profile
@nikmolnar
nikmolnar / render_geotiff.py
Last active March 17, 2016 15:56
Simple example of rendering a GeoTIFF using the mapnik RasterSymbolizer
import mapnik
m = mapnik.Map(600, 600)
m.srs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
rs = mapnik.RasterSymbolizer()
# COLORIZER_DISCRETE is a binned/classified rendere. Other options are COLORIZER_LINEAR (stretched) and
# COLORIZER_EXACT (unique)
rs.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(0, 0, 0, 0))