[gdal-dev] Re: OFTReal values truncated to integer
Even Rouault
even.rouault at mines-paris.org
Sat Apr 28 13:53:48 EDT 2012
> *Now, Python and CodeLite code work fine, and produce the value 1.3 for the
> Elev field, Qt Creator code don't and the saved value is read as 1 (because
> is codified as "1,3" and not as "1.3")!!!*
>
> Now, I took a look inside the source code of the GDAL library.
> The method that writes real values to the dbf file is
> DBFWriteDoubleAttribute (inside the ogr/ogr_frmts/shape/dbfopen.c file).
> I think that there must be a sprintf that writes values using local
> settings while it shouldn't, but I don't know the library and I'm not able
> to check. I think it's a bug to correct.
There are likely many places in GDAL where we unfortunately use locale
sensitive rountines and we shouldn't. You can workaround this at your side by
including cpl_conv.h and adding a "CPLLocaleC oLocaleCForcer;" before calling
GDAL code. This will switch to the C locale temporarily and restore the
original locale afterwards (at the end of the block where the object is
declared).
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/OFTReal-values-truncated-to-integer-tp
> 4933952p4936894.html Sent from the GDAL - Dev mailing list archive at
> Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list