Next steps
While the shapeToMap.py program has been kept deliberately simple to make it easier to understand, there is a lot that can be done to improve this program and make it more useful. You might like to try challenging yourself by implementing the following new features:
Add an optional
labelHaloentry to each map layer, which is used to draw a halo around the label text.Add a
labelPlacemententry to the map layer, to make it easy to control the label placement options.Add a
labelAllowOverlapentry to the map layer, which controls whether or not the labels are allowed to overlap.Add a
filterentry to the map layer, which is used to build amapnik.Filter()expression to limit the set of features displayed within the map layer.Add an option to dynamically calculate the visible extent of the map based on the bounding box for each feature. This would allow you to generate the map without having to calculate the bounds beforehand.
Add a call to
os.system("open map.png")(for Mac OS X) or...