[Proj] Converting NZMG -> Lat Long

Hamish hamish_nospam at yahoo.com
Mon Apr 23 23:45:51 EDT 2007


> > > The link is:
> > > http://www.linz.govt.nz/apps/coordinateconversions/index.html
> > >
> > > Depends how many you need to do?
> >
> > Quite a few more than 5 .. is there a cs2cs command line I can use
> > instead or alike?

Simon O'Malley wrote:
> Of course there is, try the following:
> 
> cs2cs +proj=nzmg +datum=nzgd49 +to +proj=latlong +datum=WGS84 -f
> "%.6f"
>
> This will put you into manual input mode. If you have them all in a
> file with coordinate pairs on separate lines then just redirect the
> file in like so:
> 
> cs2cs +proj=nzmg +datum=nzgd49 +to +proj=latlong +datum=WGS84 -f
> "%.6f"  < nzmgcoords.txt > wgs84coords.txt
> 
> The above will give you the lat longs in decimal degrees with 6
> decimal places, if you require degrees minutes and seconds just remove
> the -f part at the end.

FWIW, from a GRASS-GIS NZMG location using the 7-parm transform (same as
"proj -ld" shows) I get the following for the cs2cs "from" part:

GRASS 6.3> g.proj -jf
+proj=nzmg +x_0=2510000.0000000000 +y_0=6023150.0000000000 +a=6378388 +rf=297 +no_defs +towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993 +to_meter=1.0

Which is well tested & known to work well with about 4m accuracy (fine for
use with Google maps).

using +datum=nzgd49 should give this part:  ("proj -ld")
   +towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993

but perhaps not the needed false eastings and northings?? (+x_0 and +y_0)
same for +a and +rf??

It is simpler to just use the EPSG code, +init=epsg:27200

# NZGD49 / New Zealand Map Grid
<27200> +proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl +datum=nzgd49 +units=m +no_defs  <>


do use the LINZ online conveter to convert some test points & test your
cs2cs string before trusting the bulk conversion.



If you want 10-30cm accuracy you will need to use the LINZ NTv2 distortion
grid instead of the 3 or 7 +towgs84 params, as follows:

+proj=nzmg +x_0=2510000.0000000000 +y_0=6023150.0000000000 +a=6378388 +rf=297 +no_defs +nadgrids=/usr/share/proj/nzgd2kgrid0005.gsb +to_meter=1.0

(change /usr/share/proj/ to where you keep the grid file; download
from ftp://ftp.remotesensing.org/proj/ or LINZ's website)

 
> The above command works for me on linux should work on windows
> (shudder) but not sure.

it should do.


regards,
Hamish


More information about the Proj mailing list