= RFC 31: OGR 64bit Integer Fields and FIDs = Authors: Frank Warmerdam [[BR]] Contact: warmerdam@pobox.com[[BR]] Status: Development == Summary == This RFC addresses steps to upgrade OGR to support 64bit integer fields and feature ids. Many feature data formats support wide integers, and the inability to transform these through OGR causes increasing numbers of problems. == 64bit FID == It is planned that feature id's will be handled as type "GIntBig" instead of "long" internally. This will include the nFID field of the OGRFeature. The existing GetFID() and SetFID() methods on the OGRFeature use type long. It is difficult to change this without significant disruption to existing application code, so it is intended to introduce new methods: {{{ GIntBig OGRFeature::GetFID64(); OGRErr OGRFeature::SetFID64(GIntBig nFID ); }}} The old methods will be deprecated in favor of the new interfaces in documentation, etc. Howevever the will continue to exist, and will just cast as needed. Note that the old interfaces using "long" are already 64bit on 64bit operating systems so there is little harm to applications continuing to use these interfaces on 64bit operating systems. == 64bit Fields == New field types will be introduced for 64bit integers: {{{ OFTInteger64 = 12 OFTIntegerList64 = 13 }}} The OGRField union will be extended to include: {{{ GIntBig Integer64; struct { int nCount; GIntBig *paList; } IntegerList64; }}} The OGRFeature class will be extended with these new methods: {{{ GIntBig GetFieldAsInteger64( int i ); GIntBig GetFieldAsInteger64( const char *pszFName ); const int *GetFieldAsIntegerList64( const char *pszFName, int *pnCount ); const int *GetFieldAsIntegerList64( int i, int *pnCount ); void SetField( int i, GIntBig nValue ); void SetField( int i, int nCount, GIntBig * panValues ); void SetField( const char *pszFName, GIntBig nValue ) void SetField( const char *pszFName, int nCount, GIntBig * panValues ) }}} Furthermore, the new interfaces will internally support setting/getting integer fields, and the integer field methods will support getting/setting 64bit integer fields so that one case can be used for both field types where convenient. == Python / Java / C# / perl Changes == No thoughts yet on the impact to the various SWIG derived interfaces. == Utilities == ogr2ogr, ogrinfo and other utilities will be updated to support the new 64bit interfaces. == File Formats == As appropriate, existing OGR drivers will be updated to support the new interfaces. In particular an effort will be made to update the database driver interfaces to support 64bit integer columns for use as feature id, though I am not convinced we should create FID columns as 64bit by default when creating new layers as this may cause problems for other applications. == Test Suite == ... it is not yet clear how we would test this change in the test suite ...