[gdal-dev] How to change displayed decimal places of double type in the method: OGRFeature::SetField

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue Jul 24 22:28:33 PDT 2012


DBF formats allows specifying the precision of decimal values.
Check the field definition of the .dbf file using ogrinfo. If it shows a
precision of 2, you did all you can with OGR.

Excel, on the other hand, may have different rules. There is not much that
can be done with .dbf files to control the view in Excel.

On Wed, Jul 25, 2012 at 9:56 AM, taibc <taibc_coltech at yahoo.com> wrote:

> Hi friends,
> I used the method: OGRFeature:SetField(int i, double dfValue) to set field
> values of a shapefile file (.dbf file).
> I changed dfValue format to display 2 digits in decimal places. But, when I
> used the Excel to see values, it showed an unexpected result.
> For example:
> First, dfValue = 2688.74923
> After changing format (by using code), dfValue = 2688.75
> But, when I saw values in the excel, it showed: 2688,750000000000000 (not
> 2688.75)
> How can I fix it (don't need change format settings in excel)?
> Thanks and regards,
> Tai
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/How-to-change-displayed-decimal-places-of-double-type-in-the-method-OGRFeature-SetField-tp4990648.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

Best regards,
Chaitanya kumar CH.

17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120725/174458a6/attachment.html>

More information about the gdal-dev mailing list