[Xastir] slimming down dbf files

Jason Winningham jdw at eng.uah.edu
Thu Oct 5 13:18:18 EDT 2006


On Oct 4, 2006, at 2:25 PM, Kyle Kienapfel wrote:

> I just used a DBF Viewer 2000 from this site to cut a 300mb dbf file
> down to about 50.

I played with this a bit using the shapelib tools on some files (not  
the TIGER shape files, but can't remember which ones).  For the file  
I was looking at it didn't make much difference.  I wanted to look at  
the TIGER shapefiles because I suspected it could make some  
difference there, but never got around to it.

> if I knew which one was used by the shp
> file, I could cut a few more MB there.

Hmm, let's look at a dbfawk for clues.  Here's a section of the  
dbfawk for tgr2shp.dbfawk:

BEGIN {
# dbfinfo is the "signature" of the dbf file listing the column names  
in order.
# dbfinfo should match the dbf file that we say this dbfawk file goes  
with.
dbfinfo="MODULE:TLID:SIDE1:SOURCE:FEDIRP:FENAME:FETYPE:FEDIRS:CFCC:FRADD 
L:TOADDL:FRADDR:TOADDR:FRIADDL:TOIADDL:FRIADDR:TOIADDR:ZIPL:ZIPR:AIANHHF 
PL:AIANHHFPR:AIHHTLIL:AIHHTLIR:CENSUS1:CENSUS2:STATEL:STATER:COUNTYL:COU 
NTYR:COUSUBL:COUSUBR:SUBMCDL:SUBMCDR:PLACEL:PLACER:TRACTL:TRACTR:BLOCKL: 
BLOCKR";
#dbffields is which of the above fields we actually want to look at.
# No point reading dbffields that are not looked at further.
dbffields="TLID:FEDIRP:FENAME:FETYPE:FEDIRS:CFCC";
}


"dbfinfo" tells us that a shapefile with the fields indicated in  
dbfinfo (those names in that order) will be a match for this dbfawk.

"dbffields" tells us that we're only going to look at these fields;  
all others will be ignored in the dbfawk.

My (limited) understanding of dbfawks leads me to think we can  
eliminate all the fields that are not listed in dbffields, adjust  
dbfinfo accordingly, and we'll have a smaller file.

Why don't you try that and let us know how it goes?  (:

-Jason
kg4wsv





More information about the Xastir mailing list