Archive for June, 2010

Well, I might be a little odd, but I like the charts produced by OpenOffice 3.2 much more than those produce by Microsoft Office 2003. But I like word more than writer, so how to combine the two?

I couldn’t find any instructions online that worked for me.  These did though 🙂

Copying and pasting charts from OpenOffice Calc to Microsoft Word is a recipe for disaster.  The only effective method I have found is the follow:

  1. Copy OpenOffice Calc chart
  2. Open a new document in OpenOffice Draw.  Select Edit -> Paste Special -> GDI Metafile
  3. Right-click on the image, and select Save as Picture…
  4. Save the picture as a Windows Metafile (*.wmf), not an Enhanced Metafile (*.emf)
  5. Import into Microsoft Word via Insert Picture -> From File..
  6. Sigh with relief

The resulting image should be a vector file that word can print in a nice, antialiased way.

In a previous installment I demonstrated how to use ogr2ogr to reproject shapefiles. It turns out that its a bit trickier when you are reprojecting from AGD66 to GDA94 (and vice versa). This is because the ellipsoids they use to model the earth are different, and it turns out the be quite difficult to calculate the exact equivalent locations between them.

Difference between AGD66 and GDA94 at the ANU

Difference between AGD66 and GDA94 at the ANU

The most accurate way to convert between the two coordinate reference systems is to use a pre-calculated distortion grid. Fortunately, some clever surveyors have made one for us, available here (Webcite archive).

To download the distortion grid and put it in the right place for us to use, you can paste the following into your bash shell:

mkdir -p ~/bin
mv "A66 National (13.09.01).gsb" ~/bin/a66_national.gsb

I’ve also archived the grid files using Webcite, if the ICSM link is dead replace please see the archive.

Please note that if you change the filenames to something that contains spaces or funky punctuation ogr2ogr might not find it, and will not perform the grid transformation, leaving you with incorrect coordinates. So I would recommend just running the above code verbatim.

Then, to transform a shapefile from AGD66 to GDA94 type the following:

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

You will need to change the filenames outputgda94.shp and inputagd66.shp to whatever suits you.