Join 3,438 readers in helping fund MetaFilter (Hide)


dbf + dbf = 1992
April 28, 2009 9:53 PM   Subscribe

I'm working on some code for quickly pulling together shapefile data and other data (statistics, etc) and spitting out maps. That means JOINs. Thanks to the 1990-quality standards of GIS, attribute tables are in dbf files. How does one deal with these blasts from the past?

I'd ideally like something like sqlite which can use dbf as a backend or quickly import and export dbf files. The line of thought of using xBase, xHarbour, xcetera seems to lead to this bizarro world of programming-language-database-solutions which makes 0 sense in the modern world.

What's a guy to do?

Also - I know, ideally, a spatial database is the way to go, but in this situation, I want people to be able to do this quickly, and I know that they'll have shapefiles and tables in csv, etc., not database-ed data.

Thanks for any guidance! I've hit my google limit and am now thinking there's something obvious I'm missing...
posted by tmcw to Computers & Internet (5 answers total) 4 users marked this as a favorite
 
One of these utilities + PostGIS?
posted by zsazsa at 10:04 PM on April 28, 2009


SHP files are actually misnamed; there are a bunch of files that go along with the SHP, one of which is an xBase file. Mapping Hacks (the book) has some info on reading and writing this data. Any GIS system will pick up the DBF and use it when it loads the SHP.

Alternatively, SpatiaLite?
posted by scruss at 4:59 AM on April 29, 2009


As I understand it, you want to attribute-join shapefiles. Because of the format, your solution will inevitably be inelegant.

I wrote an ArcGIS tool which does this, and I frequently use it in models to speed up the processing of data. Memail me if you need it.

If you prefer to join without GIS software, I'd try MS Access. It is possible to load the dbf files into tables, then join, and then export. You can probably use the macro recorder for that.
posted by Psychnic at 7:49 AM on April 29, 2009


Erm, sorry, I thought I had been more specific in the question:

I don't want to join shapefiles to other shapefiles, but shapefiles to data, which will commonly be in csv format. So I'd like to simply join data in dbf files to data in csv files, so this shouldn't require SpatiaLite, ArcMap, PostGIS, etc... it's basically two semi-ancient text-database formats. I'm aware of the dbf/shp/shx distinctions... I'm just frustrated by the lack of any (Linux-based open source tools) which can do anything with dbf - even if there was something like an importer/exporter from sqlite to dbf, that would be great, but it seems like there's nothing for the format except for xHarbour and tools like that.

I'm going to try doing this with spatialite - thanks for that tip.
posted by tmcw at 10:51 AM on April 29, 2009


DBD::XBase is your awesome friend for working with dbf files. OpenOffice.org opens dbf files too.
posted by scruss at 6:54 PM on May 2, 2009


« Older What's on Obama's right wrist?...   |  My Wife will be pursuing a PHD... Newer »
This thread is closed to new comments.