Jul 16, 2011

Batch merge CanVec shapefiles with gdal(ogr2ogr)

What the script does
I couldn't find a solution to batch merging CanVec shapefiles so I made my own script to run in the Ubuntu terminal.

The only extra program the script uses is GDAL. So I had to make sure GDAL/ogr2ogr was installed on my Ubuntu machine.

This script was actually my first Bash Script ever (not the batch downloader). It has a lot of bad practices that I have improved on since then, but in its current form works!

I will update the script once I get all my stuff settled into my place (moving...)

It will start by asking you for a workspace where it can create a folder called 'shp' and some subfolders: pt, ln and ply.

The zip file contents are then extracted to the shp folder.
Only the required shapefile parts are unzipped: .shp, .shx, .dbf, .prj
The script ignores the metadata or other unnecessary files for this process..

The shapefiles are then analyzed quickly for some feedback.

A single shapefile from each CanVec category is placed into a folder: pt, ln, ply
ogr2ogr requires a source shapefile to merge all other similar shapefiles to.

Source shapfiles are then appropriately renamed and the batch merging begins!

CanVec Batch Downloader (Bash Script)

Summary
I use to use Filezilla (and still do actually, but not for this...) to batch download CanVec GIS data.

Recently I found a new method using a bash script I put together. It's one of two scripts where the second uses ogr2ogr and batch merges the CanVec data into shapefiles.

The batch download script takes a list of NTS sheets in CSV format, makes you a workspace and begins downloading the CanVec data (or Geobase DEMs) and I'll cover the method I use to format these from a DBF to get them ready for this process.

It basically involves stripping the DBF of its header and reducing it to a single column with no special characters.

The formatting is all done in OpenOffice.org Base.

Jul 15, 2011

indiGenIS - Area of Interest and CanVec (Base Data)

Treaty No. 8 in British Columbia
I have to select an Area Of Interest ('AOI') for indiGenIS and a map projection...

This will be the general extent of the basemap for my GIS which will be a subset of Treaty 8 focusing on the western portion as it intersects British Columbia.