[gdal-dev] gdal/proj4 and gtk, SpatialReference.setFromUserInput bug

Even Rouault even.rouault at mines-paris.org
Fri Jul 5 12:24:38 PDT 2013


> Does someone have a clue about what's happening ?

Yes,

this is due to the "import gtk" setting the locale from the C locale to the 
locale of the language of your system, which has likely comma has the decimal 
separator. There are a few places in GDAL/OGR that are not ready (yet) for 
that.

You can workaround the issue with the following :

"""
from osgeo import osr
import gtk
sp = osr.SpatialReference()

# Save current locale and switch to C locale
import locale
old_locale = locale.setlocale(locale.LC_ALL, None)
locale.setlocale(locale.LC_ALL, 'C')

sp.SetFromUserInput("IGNF:LAMB2C")

# Restore old locale
locale.setlocale(locale.LC_ALL, old_locale)

print sp
"""

I'll look to do the same fix in GDAL itself.


> Thanks
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list