From 60d8ed6544bb42a237452f29fdfc36d6c6db4799 Mon Sep 17 00:00:00 2001 From: springmeyer Date: Mon, 9 Jan 2012 09:22:32 -0800 Subject: [PATCH] formatting --- GettingStartedInXML.md | 68 ++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/GettingStartedInXML.md b/GettingStartedInXML.md index e0f9f21..58b8b09 100644 --- a/GettingStartedInXML.md +++ b/GettingStartedInXML.md @@ -10,7 +10,7 @@ Make sure you have mapnik installed and you've successfully run through [Getting Two examples will be shown: -1) An XML configuration that exactly matches the map output from the pure python example in [Getting Started Python Tutorial](GettingStartedInPython). +1) An XML stylesheet that exactly matches the map output from the pure python example in [Getting Started Python Tutorial](GettingStartedInPython). 2) An XML stylesheet that uses a world borders dataset with population attributes to create a chloropleth map (aka thematic) by population size. @@ -18,18 +18,18 @@ Two examples will be shown: ### Hello World XML -First you will still need a python script that sets the basic map parameters and points to the XML config file: +First you will need a python script that sets the basic map parameters and points to the XML stylesheet ```python - #!/usr/bin/env python - import mapnik - stylesheet = 'world_style.xml' - image = 'world_style.png' - m = mapnik.Map(600, 300) - mapnik.load_map(m, stylesheet) - m.zoom_all() - mapnik.render_to_file(m, image) +#!/usr/bin/env python +import mapnik +stylesheet = 'world_style.xml' +image = 'world_style.png' +m = mapnik.Map(600, 300) +mapnik.load_map(m, stylesheet) +m.zoom_all() +mapnik.render_to_file(m, image) ``` * Copy the above code and save to a file called `world_map.py` @@ -37,38 +37,36 @@ First you will still need a python script that sets the basic map parameters and Next you will need to create the `world_style.xml` file referenced in the `world_map.py` script. ```xml - + - - - - My Style - - shape - world_borders.shp - - - - + + + + My Style + + shape + world_borders.shp + + + + ``` * Copy this XML and save to a file called `world_style.xml` beside the `world_map.py` script. -Now run that script with this command: +Now run that script: -```sh python world_map.py -``` * It should output a png graphic in the same folder that matches the Getting Started Tutorial.