<p>I am trying to tranform one coordinate system to another (wgs84 to utm). Found one example on the internet (adapted a little). It got an error when I try to run the program. Since I am new to GDAL, I cannot figure out how to correct this. Please see the following program. I also tried to add one more value to "res.ct.TransformPoint(lon, lat)", but it did not solve the problem. Any help or hint appreciated. I also attach the error to the end.<br>
<br>from osgeo import osr<br>import math<br>import pyproj<br> <br>def UTMZone(lon, lat):<br> return int((lon + 180) / 6) + 1<br>if __name__ == '__main__':<br> lat = 41.395304<br> lon = 73.310067<br> <br>
wgs84 = osr.SpatialReference()<br> utm = osr.SpatialReference()<br> wgs84.ImportFromProj4("+proj=latlong +datum=WGS84")<br> utm.ImportFromProj4("+proj=utm +zone="+str(UTMZone(lon,lat))+" +datum=WGS84")<br>
ct = osr.CoordinateTransformation(wgs84,utm)<br> res= ct.TransformPoint(lon, lat)<br> print res</p>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> Error Message:<br> <br>Traceback (most recent call last):<br> File "C:\Python25\trans.py", line 28, in <module><br> res= ct.TransformPoint(lon, lat)<br> File "C:\Python25\lib\site-packages\osgeo\osr.py", line 602, in TransformPoint<br>
return _osr.CoordinateTransformation_TransformPoint(*args)<br>NotImplementedError: Wrong number of arguments for overloaded function 'CoordinateTransformation_TransformPoint'.<br> Possible C/C++ prototypes are:<br>
TransformPoint(double [3])<br> TransformPoint(double [3],double,double,double)</div>