[gdal-dev] ERROR 6: No translation for an empty SRS
Tommaso
tmassimi at hotmail.com
Tue Dec 24 14:21:37 PST 2013
Hi all,
to convert some coordinates from Lambert2 Etendu to WGS84.
I wrote the small python script you can see below.
It works fine on linux (gdal-1.9.2-5) but it doesn't work on win32
(GDAL-1.10.1.win32-py2.7.msi and gdal-110-1500-core.msi,downloaded from
http://vbkto.dyndns.org/sdk/PackageList.aspx?file=release-1500-gdal-1-10-1-mapserver-6-4-0.zip):
C:\import>python test_coord.py
ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
Traceback (most recent call last):
File "test_coord.py", line 56, in <module>
point.Transform(coordTrans)
File "z:\Programmi\python27\lib\site-packages\osgeo\ogr.py", line 4615, in Transform
return _ogr.Geometry_Transform(self, *args)
TypeError: in method 'Geometry_Transform', argument 2 of type 'OSRCoordinateTransformationShadow *'
env vars are fine:
C:\import>set gd
GDAL_DATA=c:\programmi\gdal\gdal-data
GDAL_DRIVER_PATH=c:\programmi\gdal\gdalplugins
what can I do to let the script working on windows too?
==========
import sys, os
import ogr
import osr
def getCoord(a,b):
WGS = osr.SpatialReference()
WGS.ImportFromEPSG(4326)
IGNF = osr.SpatialReference()
IGNF.ImportFromProj4("+init=IGNF:LAMBE +wktext")
coordTrans = osr.CoordinateTransformation(IGNF,WGS)
point = ogr.Geometry(ogr.wkbPoint)
point.AddPoint(a,b)
point.Transform(coordTrans)
return point.GetX(), point.GetY()
if __name__ == '__main__':
print getCoord(602262.89743,2670591.7564)
print "expected Lat=51.028160, Lon=2.368641"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131224/2d0560cd/attachment.html>
More information about the gdal-dev
mailing list