Drawing Shapes in Shapefiles

Currently there are a number of Python modules that allow you to read ESRI shapefile data

You can access the ESRI shapefile specification here

We will look at pyshp, a stand-alone utility for reading and writing shapefile (written by Joel Lawhead)

I have created a demo module, DrawShapesFromShapefile.py, that demonstrates

Using pyshp to read a shapefile

Drawing the polygon shapes in the shapefile using Tkinter

You can download my module (DrawShapesFromShapefile.py), the pyshp module (shapefile.py), and sample shapefile data here

Unzip it anywhere, then load and run DrawShapesFromShapefile.py

In __main__, you can switch between the sample shapefiles by uncommenting

There are lots of things going on here�please refer to my comments in DrawShapesFromShapefile.py

You can extend my example by adding a Tkinter file browser, adding code for drawing other kinds of shapes (polylines, etc) and so on

It should be able to read any shapefile containing polygon shapes�try it out and if it doesn�t work, let me know