I set up Mapnik to custom-render a GeoTiff file. python and xml files to do so were taken from a github mapnik example, and the successful image output is a rainbow-esque .png from the original .tif. Excellent.
All works fine, but now the question is: how can I configure Mapnik (either the python, xml or otherwise) to consider multiple .tif files when rendering images? These won't be overlapping tifs that contain different sets of information, but rather geographically-adjacent tifs that contain the same type of information. Together, they will cover a larger geographical area.
For larger context: my goal is to download all SRTM files (there are 1000s) and store them in a single directory. Using mod_tile, Mapnik, and whatever other bits of software I need, I want to be able to generate tile images of the SRTM data for consumption by a map in a browser (e.g. Leaflet, Google Map). mod_tile will be used for caching, but I will need to use Mapnik to generate images on the fly according to certain user preferences (e.g. user may be able to specify their own color bands for the elevation data).
How do I best make Mapnik consider multiple side-by-side GeoTiffs, when generating tiles? Is that even possible? do I have to create a single (massive) GeoTiff by stitching all of the SRTM files together? GDAL virtual format?
I may be looking at the problem the wrong way, as I am new to Mapnik and creating tiles - please let me know if I am.
Here is the python code:
import mapnik
mapxmlfile = 'raster_colorizer_small.xml'
outputfile = 'raster_colorizer_test.png'
m = mapnik.Map(800, 600)
mapnik.load_map(m, mapxmlfile)
m.zoom_all()
mapnik.render_to_file(m, outputfile)
And here is the raster_colorizer_small.xml file:
<Map background-color="white" srs="+init=epsg:32630">
<Style name="DISCRETE RAINBOW">
<Rule>
<RasterSymbolizer>
<RasterColorizer default-mode="discrete" default-color="white" >
<stop color="red" value = "0" />
<stop color="orange" value = "5" />
<stop color="yellow" value = "10" />
<stop color="green" value = "15" />
<stop color="blue" value = "20" />
<stop color="indigo" value = "25" />
</RasterColorizer>
</RasterSymbolizer>
</Rule>
</Style>
<Layer name="dataraster" srs="+init=epsg:32630">
<StyleName>DISCRETE RAINBOW</StyleName>
<Datasource>
<Parameter name="file">../data/dataraster.tif</Parameter>
<Parameter name="type">gdal</Parameter>
<Parameter name="band">1</Parameter>
</Datasource>
</Layer>
</Map>