Opened 7 years ago

Closed 7 years ago

#5625 closed defect (fixed)

ogr ability to write a double attribute

Reported by: ap Owned by: warmerdam
Priority: high Milestone: 1.11.1
Component: OGR_SF Version: 1.11.0
Severity: critical Keywords: double, OVERFLOW?
Cc:

Description

There appears to be an issue affecting the ability to write double (OFTReal) values.



source = ogr.Open('shp/test.shp', 1)
layer = source.GetLayer()
for feature in layer:
    feature.SetField("doublev1", 1234567890123.0)
    print feature.GetField("doublev1")
    layer.SetFeature(feature)
source.Destroy()

source = ogr.Open('shp/test.shp', 1)
layer = source.GetLayer()
for feature in layer:
    print feature.GetField("doublev1")
source.Destroy()


=== OUTPUT ===

C:\p>run_fieldissue.bat
1.23456789012e+12
1.23456789012e+12
-2147483648.0
-2147483648.0

=== SHAPEFILE INFORMATION ===
Layer name: test
Geometry: Point
Feature Count: 2
Extent: (-4.643164, 3.563339) - (-4.492787, 3.637958)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
id: Integer (10.0)
doublev1: Real (20.0)
OGRFeature(test):0
  id (Integer) = 1
  doublev1 (Real) = -2147483648
  POINT (-4.492786561264826 3.563339001746487)

OGRFeature(test):1
  id (Integer) = (null)
  doublev1 (Real) = -2147483648
  POINT (-4.643164138741583 3.637958178448969)

Change History (1)

comment:1 Changed 7 years ago by Even Rouault

Resolution: fixed
Status: newclosed

trunk r27603, branches/1.11 r27604 "Shape: fix writing values up to 253 in OFTReal fields with 0 decimal places (#5625)"

Note: See TracTickets for help on using tickets.