[gdal-dev] transform point problem using gdal 1.5 with osr

prairie Last prairie99 at gmail.com
Wed Dec 17 02:23:10 EST 2008

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.

from osgeo import osr
import math
import pyproj

def UTMZone(lon, lat):
    return int((lon + 180) / 6) + 1
if __name__ == '__main__':
    lat = 41.395304
    lon = 73.310067

    wgs84 = osr.SpatialReference()
    utm = osr.SpatialReference()
    wgs84.ImportFromProj4("+proj=latlong +datum=WGS84")
    utm.ImportFromProj4("+proj=utm +zone="+str(UTMZone(lon,lat))+"
    ct = osr.CoordinateTransformation(wgs84,utm)
    res= ct.TransformPoint(lon, lat)
    print res

 Error Message:

Traceback (most recent call last):
  File "C:\Python25\trans.py", line 28, in <module>
    res= ct.TransformPoint(lon, lat)
  File "C:\Python25\lib\site-packages\osgeo\osr.py", line 602, in
    return _osr.CoordinateTransformation_TransformPoint(*args)
NotImplementedError: Wrong number of arguments for overloaded function
  Possible C/C++ prototypes are:
    TransformPoint(double [3])
    TransformPoint(double [3],double,double,double)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20081217/cf5859be/attachment.html

More information about the gdal-dev mailing list