This is empty using Python .ImportFromEPSG(4326):
import osr
#this fails:
testSR = osr.SpatialReference()
testSR.ImportFromEPSG(4326)
print testSR.ExportToPrettyWkt()
#why did the import from EPSG fail above?
testSR.SetWellKnownGeogCS("WGS84")
print testSR.ExportToPrettyWkt()
GEOGCS["WGS 84",
DATUM["WGS_1984", and so on...
Best Answer
First, the real error was skipped, since
ImportFromEPSG
returned a non-zero error code:Now the cause. GDAL needs an environment variable
GDAL_DATA
to find and use projection info. If it is not available, then some things stop working. The SRID look-up codes are inGDAL_DATA
, for instance. Check if you have it:if
False
, it should be added to either your system's environment variables, or you can add it in run-time: