[OSRS-PROJ] NTv2 Datum transformation

Brent Fraser bfraser at geoanalytic.com
Thu Nov 20 14:17:08 EST 2003


I get it now.

The way I set up my functions was to define a "from" and "to" coordinate
system definition (here's my VB):

    sToCSD = "+proj=latlong +datum=NAD27"
    hToCSD = GPinitializeProjection(sToCSD) ' a VB friendly wrapper to
pj_init

    sFrCSD = "+proj=latlong +datum=NAD83"
    hFrCSD = GPinitializeProjection(sFrCSD)' a VB friendly wrapper to
pj_init

    status = GPdatum2datum(hFrCSD, hToCSD, -122, 49, newLon, newLat) ' a VB
friendly wrapper to pj_transform


It never occured to me to simply add the nadgrids keyword to the NAD27
coordinate system def:
    sToCSD = "+proj=latlong +datum=NAD27 +nadgrids=NTv2_0.gsb"

Thanks!
Brent

----- Original Message -----
From: "Frank Warmerdam" <warmerdam at pobox.com>
To: <osrs-proj at remotesensing.org>
Sent: Thursday, November 20, 2003 11:45 AM
Subject: Re: [OSRS-PROJ] NTv2 Datum transformation


> Brent Fraser wrote:
> > Frank,
> >
> >   I'm trying to work through a problem using proj4 to do datum
conversions
> > using NTv2 (the Canadian NAD83/27 datum shift grid file).  It seems that
> > Proj4 goes through the list of U.S and Canadian grids as specified in
> > pj_datums.c (line 75):
> >
> > nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat
> >
> > and uses the first one that returns a reasonable result.  So when I do a
> > conversion on 49N 122W, it chooses the conus grid instead of the
ntv2_0.gsb
> > grid.
> >
> > I see that with cs2cs I can set the shift file by specifying
> > "+nadgrids=ntv2_0.gsb". Is there a way I can set the shift file to use
using
> > a proj4 function call (I'm making a VB-callable DLL) ?
>
> Brent,
>
> I am not sure I understand your constraints.  The shift file selected (and
> they order they are checked for) is determined by the +nadgrids entry in
> a coordinate system definition as passed to pj_init().   You can't really
> alter the built-in datum definitions (+datum=nad27 is really just an alias
> for the corresponding +nadgrids definition).
>
> Best regards,
> --
> ---------------------------------------+----------------------------------
----
> I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
>
> ----------------------------------------
> PROJ.4 Discussion List
> See http://www.remotesensing.org/proj for subscription, unsubscription
> and other information.

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list