Eric Miller VB Wrapper +nadgrids=

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Eric Miller VB Wrapper +nadgrids=

stevejking
I'm trying to use Eric Millers VB api with Excel to convert from OSGB36 to WGS84. I'm sucessfully using From "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 +units=m +no_defs" To "+proj=longlat +a=6378137 +b=6378137 +datum=WGS84 +no_defs" But when I try to use a grid shift file for better accuracy I get a DLL Error 123. I'm using: From "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +nadgrids=C:\Program Files\MapWindow\PROJ_NAD\OSTN02_NTv2.gsb +units=m +no_defs" Does anyone know how to use a grid shift / nadgrids file with the VB api please? The Proj_Lib environment variable is set as C:\Program Files\MapWindow\PROJ_NAD. But I've also tried C:\proj\nad and moving the gsb file.
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

Eric Miller-4
>>> On 6/30/2011 at 7:22 AM, stevejking <[hidden email]> wrote:
> I'm trying to use Eric Millers VB api with Excel to convert from OSGB36 to
> WGS84. I'm sucessfully using
>
> From "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000
> +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894
> +units=m +no_defs"
>
> To "+proj=longlat +a=6378137 +b=6378137 +datum=WGS84 +no_defs"
>
> But when I try to use a grid shift file for better accuracy I get a DLL
> Error 123. I'm using:
>
> From "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000
> +ellps=airy +nadgrids=C:\Program Files\MapWindow\PROJ_NAD\OSTN02_NTv2.gsb
> +units=m +no_defs"
>  
> *Does anyone know how to use a grid shift / nadgrids file with the VB api
> please?*
>
> The Proj_Lib environment variable is set as C:\Program
> Files\MapWindow\PROJ_NAD. But I've also tried C:\proj\nad and moving the gsb
> file.

Verify that your transform works via the command line tool cs2cs.exe.

That old shim just basically exports a few function wrappers with the stdcall semantics so that they can be consumed by VB[A] code.  The arguments are passed straight to the functions that are wrapped.

The handling of file paths with spaces has historically been a problem.
--

Eric G. Miller
Staff Programmer
CA Dept. of Fish & Game



_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
Thanks for your reply.
I've checked my transformation using cs2cs and it works great replacing the +towgs84 bit with
+nadgrids=c:\proj\nad\OSTN02_TNv2.gsb

But for some reason in the VBA wrapper the nadgrids version returns a DLL error 123, even when the less accurate +towgs84 version works.

Thanks again,
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
stevejking wrote
Thanks for your reply.
I've checked my transformation using cs2cs and it works great replacing the +towgs84 bit with
+nadgrids=c:\proj\nad\OSTN02_TNv2.gsb
Sorry, this worked with cs2cs Rel 4.7.1 (which I had with FWTools), but does not work with cs2cs Rel 4.4.6 (the version that came with my proj.dll and proj_api.dll). 4.4.6 returns *    *0.00 as the coordinates. So guess it's a problem with the proj.dll version not supporting the nadgrids gsb file.

Think I read somewhere how to make the proj_api.dll from a more recent proj.dll. Where?

Cheers,
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

Eric Miller-4
>>> On 6/30/2011 at 5:33 PM, stevejking <[hidden email]> wrote:

> stevejking wrote:
>>
>> Thanks for your reply.
>> I've checked my transformation using cs2cs and it works great replacing
>> the +towgs84 bit with
>> +nadgrids=c:\proj\nad\OSTN02_TNv2.gsb
>>
>>
> Sorry, this worked with cs2cs Rel 4.7.1 (which I had with FWTools), but does
> not work with cs2cs Rel 4.4.6 (the version that came with my proj.dll and
> proj_api.dll). 4.4.6 returns *    *0.00 as the coordinates. So guess it's a
> problem with the proj.dll version not supporting the nadgrids gsb file.
>
> Think I read somewhere how to make the proj_api.dll from a more recent
> proj.dll. Where?

The source? See the proj_api.zip file.  I'm not sure if the proj_api.dll needs to be recompiled.  It may just work with newer proj.dll files.

http://ftp.dfg.ca.gov/Public/BDB/Tools/proj4/
--

Eric G. Miller
Staff Programmer
CA Dept. of Fish & Game



_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
Eric Miller-4 wrote
I'm not sure if the proj_api.dll needs to be recompiled.  It may just work with newer proj.dll files.
I tried a few newer proj.dll files, but your api only appears to work with the 4.4.6 version it was made for.
Recompiling is beyond my current skill, so I'll stick with the 7 parameter towgs84 translations for now.
Would be interested if you or anyone else recompiles against the newer proj.dll to support NTv2 files.

Thanks for your help, and for sharing your api with the world.
Regards,
Steve
 
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
This post has NOT been accepted by the mailing list yet.
I finally got around to playing with this again. Installed Visual Studio C++. And complied the current proj4 binaries using nmake. I've also installed MinGW.

I'd like to recompile Eric Millers proj_api.dll VBA linker. Wonder if you (or anyone) would mind providing instruction on how to use your makefile to produce the proj_api.dll. Aside from changing the following:

EXTRA_INCLUDES = -I. -I../proj-4.4.7/src
to
EXTRA_INCLUDES = -I. -I../proj-4.8.0/src

--target=i386-mingw32
to
--target=mingw

and removing --mno-cygwin

I've added the path C:\MinGW\bin as an Environment Variable.

Do I need any other files, or to move any files?
What do I type? mingw32-make ?
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
This post has NOT been accepted by the mailing list yet.
I've now copied proj.lib and proj_i.lib to c:\MinGW\lib

And from the command prompt
dlltools -U -d proj.def -l libproj_api.a
and put libproj_api.a in c:\MinGW\lib too. Is that right?

But when I type
MinGW32-make makefile all
I still get errors such as
dllwrap: no export definitions file provided.
Creating one, bur that may not be what you want
loads of undefined references and
collect2: ld returned 1 exit status.
dllwrap: gcc exited with status 1
mingw32-make: *** [proj_api.dll] Error 1

What have I missed ? please
Many thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
This post has NOT been accepted by the mailing list yet.
Managed to build Proj_api.dll using Mingw, but the dll does not work with recent proj.dll 4.8.0 build. Does work with 4.4.6 though. Any idea why it does not work? Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Eric Miller VB Wrapper +nadgrids=

stevejking
This post has NOT been accepted by the mailing list yet.
Compiled the updated wrapper using VC++ express

Modified Eric's original wrapper c for
pjDatumTransform
pjGeocentricToGeodetic
pjGeodeticToGeocentric
as per the current api reference (ie. nolonger x y z arrays)

and put _ prefix in the decorated .def names.

and changed "PVALUE" in projects.h and pj_param.c to "_P_VALUE"

Otherwise appears to have compiled to proj 4.8.0. Thanks for the headstart with your early files Eric Miller.