Ok. my bad perhaps.

Grabbed the shift-files from FWTools, and yes, now it works. It was, not to soon, I noticed the line
such as preprocessing the grid shift file into binary form.
I realized I had probably missed a step. But how-to do that? No idea. Try compiling Proj4, yes that works, but compiling also the nadshift files? Nope, do not work. Well, one option that always works, I grabbed them from FWTools...

Yours
Tomas

Frank Warmerdam skrev:
Tomas R wrote:
Hi again,

New problems arises as the world of Gdal is quite complex to grasp.

Have understood that the transformation of coordinates from Nad 27 datum to WGS 84 requires some look up tables to be done correctly, tables that differ with the are the Nad 27 is valid in.

Simple question is, how to set up a general solution in C# that uses these shift tables.
I have in code a simple test:
          SpatialReference spatNad27 = new SpatialReference("");
           spatNad27.SetWellKnownGeogCS("Nad27");
           SpatialReference spatNad83 = new SpatialReference("");
           spatNad83.SetWellKnownGeogCS("Nad83");
CoordinateTransformation trans = new CoordinateTransformation(spatNad27, spatNad83);
           double[] p = new double[3];
           trans.TransformPoint(p, -117, 30, 0);

that gives back
-117, 30,0000000008175
which I believe is not correct ( see http://proj.maptools.org/faq.html )

I have Proj4.dll, I have set an environment path to PROJ_LIB where the nad shift tables should exist. Must I do something else in the setup or is the call to the transform different? or have I done correctly but misinterpreted the results?

What I in reality is interested is transforming whatever coordinate in whatever projection/datum to and from WGS84 without any extra hassle fast and easy via the C# interface. That should not be to hard? Or?

Tomas,

If I test with the testepsg program (using GDAL services) with
CPL_DEBUG and PROJ_DEBUG defined ON I get the following output.

warme...@gdal64[264]% setenv PROJ_DEBUG
warme...@gdal64[265]% testepsg -t NAD27 NAD83 -117 30
OGRCT: Source: +proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
OGRCT: Target: +proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs
pj_open_lib(conus): call fopen(/wrk/home/warmerda/bld/share/proj/conus) - succeeded
Ctable Conterminous United States 273x121: LL=(-131,20) UR=(-63,50)
pj_open_lib(alaska): call fopen(/wrk/home/warmerda/bld/share/proj/alaska) - succeeded
Ctable Alaska 529x249: LL=(-194,46) UR=(-128,77)
pj_open_lib(ntv2_0.gsb): call fopen(/wrk/home/warmerda/bld/share/proj/ntv2_0.gsb) - failed pj_open_lib(ntv1_can.dat): call fopen(/wrk/home/warmerda/bld/share/proj/ntv1_can.dat) - succeeded
NTv1 393x177: LL=(-142,40) UR=(-44,84)
pj_open_lib(conus): call fopen(/wrk/home/warmerda/bld/share/proj/conus) - succeeded
pj_apply_gridshift(): used Conterminous United States
(-117.000000,30.000000,0.000000) -> (-117.000806,30.000113,0.000026)

I don't know if it is practical for you to enable debugging and see
stderr output, but if you can it might help you deduce what is
or is not working.

It *sounds* like you have done what is necessary, but it is hard
for me to know if you have made some mistake, such as preprocessing
the grid shift file into binary form.

Best regards,

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to