<div dir="ltr"><br><br><div class="gmail_quote">On Fri, Aug 8, 2008 at 9:00 PM, Michael ODonnell <span dir="ltr">&lt;<a href="mailto:odonnems@yahoo.com">odonnems@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 10pt;"><div>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.<br>
<br>Thanks for the help.<br>Mike<br><span><span style="font-family: monospace;"><br><br>import osr, ogr<br></span><br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"># CREATE WKT STRING OF
 POINT COORDS</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">sample = (&#39; 776041.000&#39;, &#39; 3386618.000&#39;)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">x = sample[0]</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">y = sample[1]</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">wkt = &#39;POINT(%s %s)&#39; % (x, y)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">#
 CREATE PROJECTION OBJECTS</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">utm16N = osr.SpatialReference ()</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">utm16N.ImportFromEPSG(26916)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">wgs84 = osr.SpatialReference()</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">wgs84.ImportFromEPSG(4326)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"># CREATE OGR POINT OBJECT, ASSIGN PROJECTION, REPROJECT</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">point = ogr.CreateGeometryFromWkt(wkt)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">point.AssignSpatialReference(utm16N)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">point.TransformTo(wgs84)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">print wkt</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;">
<span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">print point</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"></span><pre><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"></span><span><br>
</span><span></span><span></span><span><br></span></pre><br></div></div><br>

      </div><br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br>Hi Mike,<br><br>Have you setup GDAL_DATA in the environment variable?<br>
<br>Please go through the following link<br><br><a href="http://trac.osgeo.org/gdal/wiki/GdalOgrInPython">http://trac.osgeo.org/gdal/wiki/GdalOgrInPython</a><br><br>Rgds.<br>Abhay.<br></div>