Hi all, I've just found that a declaration of this type solved my problem:
OGRFieldDefn oField( "Val dbl", OFTReal ); // oField.SetWidth(64); I have no idea why. I suggest that the tutorial is updated to reflect this (common) case. Kind regards, Roland Le sam. 14 oct. 2023 à 16:12, Roland Baviere <roland.bavi...@districtlab.eu> a écrit : > Dear Community, > > I hope this e-mel finds you well. > > I am trying to write a shaprfile from a C++ application (windows), > following the tutorial found here: > https://gdal.org/tutorials/vector_api_tut.html#writing-to-ogr > > Everything works fine except for Fields of the OFTReal type, which are > systematically truncated in the produced shapefile, as if they were > declared as integer. > > The example illustrates the declaration of a string type: > > OGRFieldDefn oField( "Name", OFTString ); > oField.SetWidth(32); > > I tried to adapt it to the case were I want to serialize a field of the > double type: > > > OGRFieldDefn oField( "Val dbl", OFTReal ); > > oField.SetWidth(64); > > > > but the aforementionned truncation error occurs. > > > What am I doing wrong? > > > Thanks a lot for your help and time. > > > Kind regards, > > > Roland BAVIERE > > >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev