[gdal-dev] osr transformto error

Michael ODonnell odonnems at yahoo.com
Fri Aug 8 11:30:55 EDT 2008


I am trying to run a simple script and the class transformto does not appear to be working for me. I have used GDAL before for raster analysis, but I have little experience with OSR. Does anyone have any ideas as to why this is not working? I have also run a script I found online called test_transformation_osr.py and it also produces errors when transforming between spatial references. In other words, there seems to be a problem with the installation or something was not installed that I should have installed. I installed gdal1.5.2 binaries on win32 xp OS system.

Thanks for the help.
Mike


import osr, ogr

# CREATE WKT STRING OF POINT COORDS
sample = (' 776041.000', ' 3386618.000')
x = sample[0]
y = sample[1]
wkt = 'POINT(%s %s)' % (x, y)

# CREATE PROJECTION OBJECTS
utm16N = osr.SpatialReference ()
utm16N.ImportFromEPSG(26916)
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326)

# CREATE OGR POINT OBJECT, ASSIGN PROJECTION, REPROJECT
point = ogr.CreateGeometryFromWkt(wkt)
point.AssignSpatialReference(utm16N)
point.TransformTo(wgs84)

print wkt
print point


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080808/eb3e0fc6/attachment.html


More information about the gdal-dev mailing list