diff --git a/World-population-tutorial.md b/World-population-tutorial.md index db6a5ec..0ff8aa3 100644 --- a/World-population-tutorial.md +++ b/World-population-tutorial.md @@ -2,21 +2,27 @@ ## Overview -This tutorial is designed to introduce a few more advanced Mapnik styling features, mainly `Rules` and `Filters`. +This tutorial is designed to introduce a few more advanced Mapnik styling features, mainly `Rules` and `Filters`. This XML file is only compatible with Mapnik 2.x and above. + +This script should result in a graphic similar to: + +[[/images/world_population.png]] + + * Note: text labeling positions may be different between Mapnik versions. ## Step 1: data For this tutorial we'll use the same world borders shapefile from natural earth used for the first two tutorials. Refer to either [Tutorial 1](GettingStartedInPython) or [Tutorial 2](XMLGettingStarted) for details. -This script should result in a graphic like this: +## Step 2: Script -[[/images/world_population_minimized.png]] +Save the below code into a file called `world_population.py`: ```python #!/usr/bin/env python import mapnik -mapfile = "population.xml" +mapfile = "world_population.xml" m = mapnik.Map(1400, 600) mapnik.load_map(m, mapfile) bbox = mapnik.Envelope(mapnik.Coord(-180.0, -75.0), mapnik.Coord(180.0, 90.0)) @@ -24,139 +30,105 @@ m.zoom_to_box(bbox) mapnik.render_to_file(m, 'world_population.png', 'png') ``` -And here is the xml file: +## Step 3: Stylesheet + +Save the below XML into a file called `world_population.xml` in the same directory as the `world_population.py` python script: ```xml - - - - - - - - - - - - - population - countries_label - - shape - - - /PATH/TO/THE/TM_WORLD_BORDERS_SIMPL-0.3 - - + - + + + + + + population + countries_label + + shape + ne_110m_admin_0_countries.shp + + + + ``` \ No newline at end of file