Reading and writing Esri shapefiles in Delphi

Esri Shapefile is a popular file format in geographic information systems (GIS). Probably because the format has been extensively documented (whitepaper in PDF format).

In my day job at a company that does road condition surveys I work with quite a lot of data in shapefile format, so in order to read and write them I wrote two Delphi units. These units have been in existence for quite a while but until recently they could only process rather basic file types with points and polylines. After having the need to process additional types, I have updated (and bugfixed) them, so they now can read the following shape types:

  • Point, PointZ, PointM
  • Polygon, PolygonZ, PolygonM
  • Polyline, PolylineZ, PolylineM
  • MultiPoint, MultiPointZ, MultiPointM

Please note that they only accesses the .shp file, not the accompanying .dbf, .proj, .shx and other files. The .dbf files are simply dbase files, so you could use e.g. tdbf for them (But check the tdbf license!). The .proj files are text.

The writer is more basic yet, it can only write Point shapes.

Both are part of dzlib, my general purpose library, and available under the Mozilla Public License from the svn repository on SourceForge OSDN: