I am a newbie to OGR/OSR using Python 2.7.2, please excuse my ignorance:<br><br>I'm having problems creating spatial reference using either .ImportFromEPSG<br>or .ImportFromESRI(prjfile string). <br>Yet .SetWellKnownGeogCS works fine.<br>
<br>from osgeo import ogr<br>import osr,os<br>testSR = osr.SpatialReference()<br>testSR.SetWellKnownGeogCS("WGS84")<br>print testSR.ExportToPrettyWkt()<br>#returns<br>#GEOGCS["WGS 84",<br> # DATUM["WGS_1984",<br>
#....and so on...<br><br>testSR.ImportFromEPSG(4326)#returns 6<br>print testSR.ExportToPrettyWkt() #returns zero length string<br><br>prjFile = open('c:/test/GCS_WGS84.prj')<br> strPrj = prjFile.readline() #returns string with len 145<br>
testSR.ImportFromESRI(strPrj)#returns 5<br> print testSR.ExportToPrettyWkt() #returns zero length string<br>