views:

88

answers:

2

How can I convert a shapefile from AGD66 to GDA94 programmatically, using open source libraries? I don't want to use arcgisscripting because I don't have a licence.

This needs to be automatable. A bash or python script would be acceptable.

This is a little more complicated than a normal reprojection, because a different ellipsoid is used between these coordinate reference systems, and thus a distortion grid needs to be used.

+2  A: 

Use the OpenSource GDAL libraries.

To convert coordinates on their own us the GGAL transform utility: http://www.gdal.org/gdaltransform.html

To convert a whole shapefile use: http://www.gdal.org/ogr2ogr.html

There is a command line example for a shapefile at the bottom of the page.

geographika
This doesn't work for shapefiles, only coordinates.
fmark
Sorry read too quickly, and missed it was for whole shapefiles. Added the correct utility link - but I saw that you'd already found it. There are also Python bindings for GDAL if you need to use this as part of a longer process.
geographika
It was the business with gridshift files that was killing me in the end
fmark
A: 

Sorry to answer own question, but here goes for posterity. Using the instructions here, first download the distortion grid:

wget http://www.icsm.gov.au/icsm/gda/gdatm/national66.zip
unzip national66.zip
mkdir -p ~/bin
mv "A66 National (13.09.01).gsb" ~/bin/a66_national.gsb
rm national66.zip

Then use ogr2ogr to reproject:

ogr2ogr -f "ESRI Shapefile" -s_srs "+proj=longlat +ellps=aust_SA +nadgrids=~/bin/a66_national.gsb +wktext" -t_srs EPSG:4283 outputgda94.shp inputagd66.shp
fmark