more cleanup

springmeyer 2012-01-09 09:19:28 -08:00
parent 8d2ca9ea35
commit ccd3aef2f6

@ -24,26 +24,20 @@ First you will still need a python script that sets the basic map parameters and
```python ```python
#!/usr/bin/env python #!/usr/bin/env python
import mapnik import mapnik
mapfile = 'world_styles.xml' stylesheet = 'world_style.xml'
map_output = 'hello_world_using_xml_config.png' image = 'world_style.png'
m = mapnik.Map(600, 300) m = mapnik.Map(600, 300)
mapnik.load_map(m, mapfile) mapnik.load_map(m, stylesheet)
bbox = mapnik.Envelope(mapnik.Coord(-180.0, -90.0), mapnik.Coord(180.0, 90.0)) m.zoom_all()
m.zoom_to_box(bbox) mapnik.render_to_file(m, image)
mapnik.render_to_file(m, map_output)
``` ```
* Copy this code and save to a file called *world_map.py* * Copy the above code and save to a file called `world_map.py`
Next you will need to create the *world_styles.xml* file referenced in the *world_map.py* Next you will need to create the `world_style.xml` file referenced in the `world_map.py` script.
Note: you will need to specify the path to the same Mapping Hacks [world borders shapefile](http://mappinghacks.com/data/world_borders.zip) using in Tutorial 1
```xml ```xml
<Map bgcolor="steelblue" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="steelblue" srs="+proj=latlong +datum=WGS84">
<Style name="My Style"> <Style name="My Style">
<Rule> <Rule>
@ -57,18 +51,18 @@ Note: you will need to specify the path to the same Mapping Hacks [world borders
</Rule> </Rule>
</Style> </Style>
<Layer name="world" srs="+proj=latlong +datum=WGS84"> <Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName> <StyleName>My Style</StyleName>
<Datasource> <Datasource>
<Parameter name="type">shape</Parameter> <Parameter name="type">shape</Parameter>
<Parameter name="file">/path/to/your/world_borders</Parameter> <Parameter name="file">world_borders.shp</Parameter>
</Datasource> </Datasource>
</Layer> </Layer>
</Map> </Map>
``` ```
* Copy this XML and save to a file called *world_styles.xml* beside the *world_map.py* script * 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 with this command: