6

I have been looking around like crazy, not finding any specification which versions of dBase shapefiles support (ESRI shapefiles).

I found that GeoTools uses dBase III only, and Wikipedia says dBase IV only.

I'm writing a reader, how should I decide which formats to use, and are they any different?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Johan S
  • 393
  • 1
  • 3
  • 12
  • Man called William Huber writes here that it is labeled as dBASE IV but dBASE III works just fine, too http://forums.esri.com/Thread.asp?c=3&f=38&t=104464%29. But there are quite a many shapefile readers already, perhaps you cold spend your time to something more exciting and valuable for the people? – user30184 Nov 11 '14 at 15:08
  • Writing your own reader might make sense if you are writing your own query/render engine. For instance, MapDotNet shapefile support includes simple attribute queries and a proprietary indexing schema for geometry or attribute indexes. – Russell at ISC Nov 11 '14 at 15:30

2 Answers2

5

Having written a shapefile reader for MapDotNet, I recommend following the dBase IV spec. Once you start opening files from many sources you will find odd discrepancies, for instance older versions of the PostGIS tools filled null numeric with *.

Russell at ISC
  • 1,912
  • 10
  • 11
  • dBase IV didn't exist when shapefile was created. The Esri shapefile implementation is based on dBase III+ (without memo support). – Vince Nov 11 '14 at 17:34
  • @Vince, looking at my old code I see at some point I replaced 4 with 3 in the "write header" code, but I worked off the IV spec and I don't recall any other incompatibilities. Old dBase specs are hard to dig up, I may have used IV because it was what I could find. Yes, memo is not supported. – Russell at ISC Nov 11 '14 at 18:15
  • Oh, and the code has been used extensively over close to a decade. – Russell at ISC Nov 11 '14 at 18:17
1

As per documentation first byte of DBF file determines its version. If you open any DBF file generated by Esri software it will have first byte set to 0x03 (displayed as ASCII EXT in many hex viewers). First byte set to 3 stands for dBASE III.

First byte in dBASE III file

Kuba Szostak
  • 162
  • 5