I have got a simple map in QGIS, containing only 1 layer which consists of 10+ features. Now I need to (programmatically) generate about 200 different JPEG map images of the same area. Each map should have the very same map extents and all features visible. However, the features should have different set of colors in each generated map. In detail, I have a CSV file containing the categorized colors for each feature (1 line for each image, 1 column and color per feature), something like this:
"A","B","C","D","E","F" (header line, 6 columns in this file)
"#000000","#FF0000","#00FF00","#0000FF","#0000FF","#808080"
"#000000","#FF0000","#FF0000","#00FF00","#00FF00","#808080"
"#FF0000","#FF0000","#000000","#800080","#FFFFFF","#FFFF00"
...
My current plan is to use Perl or similar similar to create 200 different QML files based on this CSV file. Then I plan to write a Python script to
- Loop through QML files
- Open each QML file, one at a time, and apply layer style from it
- Open map composer and save raster image file
- Close map composer and jump into the next QML file
I am now asking for any input concerning:
- Can this be done within QGIS + Python?
- Any better ways to achieve my goal?
- Hints on any existing source code or plugin to achieve this?