Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

OGR for merging shapefiles

Posted by smathermather on June 8, 2013

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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: