dbfpy
Both OGR and PyShp read and write the dbf
files because they are part of the shapefile specification. However, both libraries have a very basic dbf
support. Occasionally you will need to do some heavier duty dbf
work. The dbfpy
module is a pure Python module dedicated to working with dbf
files. It is hosted on sourceforge.net
but has an entry on PyPI. However, the PyPI entry is not correctly configured and you have to force easy_install
to find the download by specifying the download directory:
easy_install -f http://sourceforge.net/projects/dbfpy/files/dbfpy/2.2.5/dbfpy
If you are using pip
to install packages, use the following command:
pip install http://downloads.sourceforge.net/project/dbfpy/dbfpy/2.2.5/dbfpy-2.2.5.tar.gz
The following shapefile has over 600 dbf records representing US Census Bureau tracts which make it a good sample for trying out dbfpy
: https://geospatialpython.googlecode.com/files/GIS_CensusTract.zip
Let's open up the dbf
file of this shapefile and look at the...