[gdal-dev] OGR precision vs Scale and DateTime values not set

Frank Warmerdam warmerdam at pobox.com
Sat Dec 29 15:19:55 EST 2007


Clay, Bruce wrote:
> There seems to be a difference in the way ESRI uses precision and scale 
> to that of OGR.  I don’t know which is right.  I am using the c# 
> libraries include in the FWTools.2.0.3.
> 
> OGR does not appear to have a data type of Double when displayed in 
> ArcMap.  The stored attribute value appear correct but the parameters 
> are different
> 
> I defined the double field as:
> 
>  
> 
> fieldDef = new FieldDefn(“LATITUDE”, FieldType.OFTReal);
> 
> fieldDef.SetWidth(8);
> 
> fieldDef.SetPrecision(38);
 >
> and ArcMap shows Type = Float, Length = 8, Precision = 7, and Scale = 38

Bruce,

I'm not sure what ESRI means by Scale. But for OGR precision should be
less than width.  That is width specifies the full width of the field
and precision indicates how many characters of the field are used for
the decimal places.  So "123.456" would have a width of seven and a
precision of three.

> Also the DateTime fields are not getting set.  If I use the 
> DisplayFeature method in the c# createData.cs example, the date time 
> fields appear to be set properly (2006/10/10 9:00:00) but is I use 
> ogrinfo –al the the date fields are not set.

Are you working with Shapefiles?  I think the shapefile driver only
supports date fields, not datetime or time.  But I would expect that
at least the date would be handled.  If you can file a bug demonstrating
broken OFTDate field support, I would appreciate that.

PS. OFTDateTime is *supposed* to be automatically treated as
OFTDate internally.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list