Shapelib-Fortran

This package contains Fortran 90/95 bindings to the Shapefile C Library for accessing ESRI Shapefiles, a common format in Geographic Information Systems for vector data.

NOTICE: This package is not under active developent anymore, please refer to the FortranGIS project for a new and more complete Fortran interface to GIS libraries using ISO_C_BINDING facilities of Fortran 2003.


Download

The Shapelib-Fortran package version 1.3 can be downloaded directly from this page.

Build

The package is configured with the standard GNU autotools, so, in the simplest case, the building procedure consists in typing:
./configure
make
make install
Try configure --help for more options to the configure script, for example for indicating a particular Fortran compiler. Make sure that the shapelib package (including the development package if you distribution has one) is installed and accessible before trying to build the Fortran bindings.

The package contains also a spec file so that you can quickly build a rpm package, on a GNU/Linux system supporting rpm, just issuing the command rpmbuild -ba <package-name>.tar.gz.

Shapelib-fortran has been tested on Fedora 12 and Debian lenny i386/x86_64 GNU/Linux systems. It has been successfully tested with gfortran, g95 and pgf90 Fortran compilers.


Use

In order to access the shapelib API from a Fortran program you have to add
USE shplib
to your program unit. The API has been kept as close as possible to the original C API; the retrieved shapes are stored in a Fortran derived type shpobject which mimics the C structure SHPObject. Notice that the shpopen function, unlike Fortran OPEN statement, requires the filename variable not to contain trailing blanks unless this is explicitly wanted as a part of the filename!, so the use of the Fortran intrinsinc function TRIM() is suggested in this case.

See shplib.f90 for the parameter and derived type definitions and shp_read_test.f90 and shp_write_test.f90 for an example.

Be warned that the Fortran bindings do not support the DBF attribute features of the C shapelib.


Support

If you have questions, doubts or requests for improvement concerning the shapelib Fortran bindings, please address them to Davide Cesari (dcesari69 <at> gmail <dot> com; it). Other enquiries concerning the Shapefile C library should be addressed to the maintainer of the library, Frank Warmerdam, as indicated in the shapelib web page.


License

Shapelib-Fortran
Fortran 90/95 bindings for shapelib
Copyright (C) 2011 Davide Cesari, dcesari69 <at> gmail <dot> com
The sources are distributed according to the GNU LGPL license.
See LICENSE file for the full license terms.


Last Update 01/06/2011
Back to main page.