[gdal-dev] osr transformto error

abhay menon abhay.menon at gmail.com
Fri Aug 8 11:46:43 EDT 2008


On Fri, Aug 8, 2008 at 9:00 PM, Michael ODonnell <odonnems at yahoo.com> wrote:

> 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
>
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

Hi Mike,

Have you setup GDAL_DATA in the environment variable?

Please go through the following link

http://trac.osgeo.org/gdal/wiki/GdalOgrInPython

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


More information about the gdal-dev mailing list