If you are familiar with Maperitive you will know that it has had a scripting language for a long time and recently it also introduced Python scripting. For this post I am still using the old scripting framework. I imagine it can easily be ported to Python.
The Maperitive script references some custom rulesets that I created to allow me to explicitly style the contour lines. Following is the code I used to automate map generation and upload.
- contours-white.mrules
- a Maperitive ruleset styling white contour lines with transparent background
- contours.mrules
- a Maperitive ruleset styling brown contour lines with transparent background
- contours.mscript
- the Maperitive commands required to generate brown contours, white contours and hillshading. Note that color-depth=32. This is required to allow transparent backgrounds in the tiles stored in the MBtiles database
- create_and_upload.bat
- The batch file that first runs the Maperitive script and then automates upload into MapBox using TileMill. The upload requires syncAccount and syncAccessToken for your MapBox account. See http://boulderalfmaps.blogspot.com/2013/01/tilemill-sync-info.html for details about how to do this.