In this day of GUI GIS, sometimes you can’t beat the good old command line for getting a job done, regardless of whether you use Linux/Unix, Mac OS X, or Windows. This may sound strange coming from someone heavily invested in a GUI project but its true.
Case in point - I recently needed to create two seamless regional layers from over 100 individual shapefiles. The source shapefiles were stored in individual subdirectories two levels deep. This translates into a lot of pointing and clicking to add each shapefile to the appropriate list in a GUI prior to appending them all together. To make matters worse, I had two shapefiles in each subdirectory that needed to be merged, resulting in two layers. This would mean even more pointing and clicking.
Enter a humble Ruby script (about 15 lines with comments) mixed in with a little bit of ogr2ogr and the process takes no time at all. Of course you can substitute Ruby with Perl/Python/Shell or whatever. Fortunately the individual files were consistently named in each directory. The script just gets the list of top-level directories, creates a command to pass to ogr2ogr and executes it, successively appending the individual shapefiles to create the regional shapefile. This takes like 10 seconds to run. Creating the second shapefile was a matter of changing a line or two in the script (I didn’t take time to make it robust with argument handling) and in another 10 seconds the job is done. In the GUI world, I’d still be clicking around (Ok, I’m exaggerating but you get the idea). Of course most of the GUI Desktop GIS applications provide some sort of scripting language to do this sort of job, but often navigating the complicated API associated with an embedded scripting language takes longer to do than the actual job. If I’m in a hurry, I just want to get the job done, not navigate some complex object model to work out how to do a simple task.
There seems to be a trend in the commercial GIS world away from command line interfaces in favor of heavy GUI toolboxes and interfaces. I often find these limiting and extremely slow, if they operate at all. Mixing a scripting language executed from the command line with the many excellent Open Source GIS tools (GDAL/OGR included) often provides a fast and powerful way to get the job done.