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

Clay, Bruce bclay at ball.com
Thu Dec 27 17:11:30 EST 2007


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

 

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.

 

I have defined them as follows:

 

fieldDef = new FieldDefn("DATE_TIME", FieldType.OFTDateTime);

fieldDef.SetWidth(36);

fieldDef.SetPrecision(0);

 

ArcMap shows Type = Date Length = 8, Precision = 0; scale = 0

 

And I set the value with:

 

fieldIndex = featureDef.GetFieldIndex(shapeFieldList[3].fieldName);

if (fieldIndex >= 0)

{

feature.SetField(fieldIndex, minDate.Year, minDate.Month, minDate.Day,

minDate.Hour, minDate.Minute, minDate.Second, 0);

}

 

I also tried:

feature.SetField(fieldIndex, minDate.ToString("yyyy-MM-dd HH:mm:ss"));

 

but it didn't work either

 

 

Any thoughts as to what I am doing wrong would be greatly appreciated.

 

Bruce




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20071227/1667ef4f/attachment.html


More information about the gdal-dev mailing list