1 |
jan |
1611 |
|
2 |
|
|
Python bindings for Shapelib |
3 |
|
|
============================ |
4 |
|
|
|
5 |
|
|
These are two python modules for shapelib created with SWIG. |
6 |
|
|
|
7 |
|
|
Shapelib is a free software library for reading and writing ESRI shape |
8 |
|
|
files and can be found at http://gdal.velocet.ca/projects/shapelib. |
9 |
|
|
|
10 |
|
|
SWIG is tool that can generate wrappers of C and C++ libraries for a |
11 |
|
|
variety of scripting languages. It's homepage is www.swig.org. |
12 |
|
|
|
13 |
|
|
The two modules here wrap the shape file reading and writing API and the |
14 |
|
|
DBF file reading and writing API. The shape file bindings are currently |
15 |
|
|
limited to 2-dimensional data. |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
Requirements |
19 |
|
|
------------ |
20 |
|
|
|
21 |
|
|
To compile the bindings, you need shapelib 1.2.8. Older versions may or |
22 |
|
|
may not work, I've only tested the code with 1.2.8. |
23 |
|
|
|
24 |
|
|
SWIG is not required. The files generated by SWIG are contained in the |
25 |
|
|
archive. If modify shapelib.i or dbflib.i and need to recreate the |
26 |
|
|
generated files, you need at least SWIG 1.3. |
27 |
|
|
|
28 |
|
|
You also need Python, of course. If you installed prebuilt packages such |
29 |
|
|
as RPMs of some Linux distributions, please make sure that the |
30 |
|
|
development package is also installed. |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
License |
34 |
|
|
------- |
35 |
|
|
|
36 |
|
|
The shapelib python bindings are covered by the LGPL. See COPYING for |
37 |
|
|
more information. |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
Compilation and Installation |
41 |
|
|
---------------------------- |
42 |
|
|
|
43 |
|
|
Pyshapelib uses the python distutils which come with Python 2.0 or newer |
44 |
|
|
and are also available separately from python.org for older versions. |
45 |
|
|
|
46 |
|
|
To compile the bindings, unpack the archive under the shapelib archive |
47 |
|
|
or move the directory there if you've already unpacked it. Then run |
48 |
|
|
|
49 |
|
|
python setup.py build |
50 |
|
|
|
51 |
|
|
to build the bindings. The result can be found under the (new) build |
52 |
|
|
subirectory. |
53 |
|
|
|
54 |
|
|
To install run |
55 |
|
|
|
56 |
|
|
python setup.py install |
57 |
|
|
|
58 |
|
|
which will install the bindings into python's site-packages directory. |
59 |
|
|
You can use the intall command's --prefix option to select a different |
60 |
|
|
installatin directory. |
61 |
|
|
|
62 |
|
|
For more information about the setup.py script, invoke it with the |
63 |
|
|
--help option: |
64 |
|
|
|
65 |
|
|
python setup.py --help |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
Documentation |
69 |
|
|
------------- |
70 |
|
|
|
71 |
|
|
There's no real documentation for the python bindings themselves, but |
72 |
|
|
there's a simple demo/test script called pytest.py. |
73 |
|
|
|
74 |
|
|
The change history is recorded in NEWS and in detail in ChangeLog. |