
Python bindings for Shapelib
============================

These are three python modules for shapelib:

   shapelib	read/write shapefiles

   dbflib	read/write dbf files

   shptree	quadtree for shapes

Shapelib is a free software library for reading and writing ESRI shape
files and can be found at http://shapelib.maptools.org/.

The bindings were partly created with SWIG, a tool that can generate
wrappers of C and C++ libraries for a variety of scripting languages.
It's homepage is http://www.swig.org.

The bindings themselves don't have a homepage at the moment, but the
source tarballs/zip files can be downloaded from
http://ftp.intevation.de/users/bh/pyshapelib/


Requirements
------------

To compile the bindings, you need shapelib 1.2.9 or newer and Python 2.0
or newer.

SWIG is not required. The files generated by SWIG are contained in the
archive. If you modify shapelib.i or dbflib.i and need to recreate the
generated files, you need SWIG 1.3 Alpha 5.  It's unlikely that other
versions will work.
In addition you need to add the following lines to  initdbflibc(void)
in dbflib_wrap.c.
    /* because we are in a python module now, we can give out
     * pointers to python's locale agonistic function 
     * XXX this clearly is a hack
     */
    DBFSetatof_function(&PyOS_ascii_atof);

You also need Python, of course.  If you installed prebuilt packages
such as RPMs of some Linux distributions, please make sure that the
development package is also installed.


License
-------

The shapelib python bindings are covered by the LGPL. See COPYING for
more information.


Compilation and Installation
----------------------------

Pyshapelib uses the python distutils which come with Python 2.0 or newer
and are also available separately from python.org for older versions.

To compile the bindings, unpack the archive under the shapelib archive
or move the directory there if you've already unpacked it.  The setup
script expects to find the shapelib files in the parent directory.  Then
run

    python setup.py build

to build the bindings. The result can be found under the (new) build
subirectory.

To install run

    python setup.py install

which will install the bindings into python's site-packages directory.
You can use the intall command's --prefix option to select a different
installatin directory. 

For more information about the setup.py script, invoke it with the
--help option:

    python setup.py --help


Documentation
-------------

There's no real documentation for the python bindings themselves, but
there's a simple demo/test script called pytest.py.

The change history is recorded in NEWS and in detail in ChangeLog.


Contact Information
-------------------

pyshapelib is currently being developed as part of the interactive
viewer for geographic data Thuban, so the best way to reach the
developers is to post on the Thuban mailing lists.

Thuban:
   http://thuban.intevation.org/

Thuban mailing lists:
   http://thuban.intevation.org/mailinglist.html
