Converting a shapefile's projection

Just recently whilst working on a project that utilized Google Maps I found myself needing to convert the projections for a set of ESRI Shapefiles that I'd acquired from the Ordnance Survey website.
After spending the good part of a day looking for tools for doing such a task I thought I'd write an article about it for future reference.

The Shapefiles in question were of the UK's boundaries, and as such the projections were Eastings/Northings (EPSG:27700), as opposed to the Latitude/Longitude (WGS84) required.

Searching the internet for a good deal of time finally brought my attention to a great set of command-line tools, called OGR, that allowed me to convert projections (such as Northings/Eastings) from a variety of different geospatial vector file-formats, one of which being ERSI Shapefiles. Below is a step-by-step list of what must be done with these tools in order to convert a Shapefile's projection.

  1. Download and Install OSGeo4W

    Follow the Quick-Start Guide for how to install OSGeo4W.
    There are many pieces of geospatial software that come along with OSGeo4W, in our case we're after OGR.

  2. Convert your Shapefile's projection

    Once OSGeo4W is installed load up "OSGeo4W Shell" and type the following into the command-prompt that appears:

    $> ogr2ogr -t_srs <New Projection> <Output SHP file> <Original SHP file>
    #Converting the county_region shapefile to the WGS84 projection
    #ogr2ogr -t_srs WGS84 C:\Shapefiles\county_region_output.shp C:\Shapefiles\county_region.shp

  3. Confirm the Shapefile's projection has been converted

    To test that the projection has been changed you can use "ogrinfo", like so:

    $> ogrinfo.exe <Path to SHP file> -al -so
    #Example: ogrinfo.exe C:\Shapefiles\county_region_output.shp -al -so