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开发者_Python百科 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.
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.
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
精彩评论