First let me admit I know almost nothing about this and it's been a while since I wrote and used the following code snippet. It is not complete but gives an example of a few lines which do what you want. It uses the dll from the corpscon coordinate reprojection library which for which the documentation is quite easy to find on the web. My hope is that if you looked at a combination of the ctypes documentation, the corpscon dll documentation, and the following snippet, you might gather some useful information. It is amazing how much power you can add to a program using DLL's and didn't seem that bad once I got the hang of it.
- from ctypes import *
-
-
corpslib = windll.LoadLibrary("C:\Program Files\Corpscon6\corpscon_v6.dll")
-
tmpStr = create_string_buffer(256)
-
corpslib.corpscon_default_config ()
-
corpslib.corpscon_initialize_convert()
-
stat = corpslib.SetNadconPath(r"C:\Program Files\Corpscon6\Nadcon")
-
stat = corpslib.SetVertconPath(r"C:\Program Files\Corpscon6\Vertcon")
-
stat = corpslib.SetGeoidPath(r"C:\Program Files\Corpscon6\Geoid")
-
stat = corpslib.SetInSystem(3)
-
stat = corpslib.SetInDatum(InDatum)
-
stat = corpslib.SetOutSystem(2)
-
stat = corpslib.SetOutDatum(OutDatum)
-
stat = corpslib.SetInUnits(3)
-
stat = corpslib.SetOutUnits(OutUnits)
-
stat = corpslib.SetInZone(UTMZone)
-
stat = corpslib.SetOutZone(OutZone)
-
inDatum = corpslib.GetInDatum()
-
outDatum = corpslib.GetOutDatum()
-
inSystem = corpslib.GetInSystem()
-
outSystem = corpslib.GetOutSystem()
-
inUnits = corpslib.GetInUnits()
-
outUnits = corpslib.GetOutUnits()
-
inZone = corpslib.GetInZone()
-
outZone = corpslib.GetOutZone()
-
I also remember something about having to pass in c double pointers which was accomplished in the following code.
- inx = c_double(StartX)
-
iny = c_double(StartY+(value*GridSize))
-
inz = c_double(0.00)
-
outx = c_double()
-
outy = c_double()
-
outz = c_double()
-
corpslib.SetXIn(inx)
-
corpslib.SetYIn(iny)
-
corpslib.SetZIn(inz)
-
corpslib.corpscon_convert()
-
corpslib.GetXOut.restype = c_double
-
corpslib.GetYOut.restype = c_double
-
corpslib.GetZOut.restype = c_double
-
PtX = corpslib.GetXOut()
-
PtY = corpslib.GetYOut()
-