OGR for merging shapefiles

I upgraded to Ubuntu 12.10.  It’s nice, but it means I can no longer run QGIS 1.9 easily, so I’m limping along with 1.8, and without functional python extensions at that.

So, when I wanted to merge a directory of 60 some odd shapefiles, I turned to OGR.  GIS Programming at http://gis-programming.com/?p=194 shows how to do it on Windows.  Here’s the linux/BASH way:

for f in *.shp; do ogr2ogr -update -append merge.shp $f -f "ESRI Shapefile"; done;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.