I'm having the same problem. I tried another way according to one example I found, which doesn't work either:
from osgeo import ogr, osr # Get the geometry object ds = ogr.Open("inFile.shp") layer = ds.GetLayer() feature = layer.GetNextFeature() geom = feature.GetGeometryRef() # Get the coordinate systems and transform inSR = osr.SpatialReference() inSR.GetGeometryRef() # this is WGS84 outSR = osr.SpatialReference() outSR.ImportFromEPSG(2400) # RT90 (Sweden) coordTrans = osr.CoordinateTransformation(inSR, outSR) geom.Transform(coordTrans) Results in the following error message: TypeError: in method 'Geometry_Transform', argument 2 of type 'OSRCoordinateTransformationShadow *' prairie Last wrote: > > 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))+" > +datum=WGS84") > 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 > TransformPoint > return _osr.CoordinateTransformation_TransformPoint(*args) > NotImplementedError: Wrong number of arguments for overloaded function > 'CoordinateTransformation_TransformPoint'. > Possible C/C++ prototypes are: > TransformPoint(double [3]) > TransformPoint(double [3],double,double,double) > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev > -- View this message in context: http://n2.nabble.com/transform-point-problem-using-gdal-1.5-with-osr-tp2036503p2262370.html Sent from the GDAL - Dev mailing list archive at Nabble.com. _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev