public object get_mapped_value(OSGeo.OGR.Feature feature, int esriFieldsIndex) { // get the ESRI Field ESRI.ArcGIS.Geodatabase.IField pField = m_fields.get_Field(esriFieldsIndex); if (esriFieldsIndex == m_oidFieldIndex) return feature.GetFID(); if (esriFieldsIndex == m_geometryFieldIndex) { System.Diagnostics.Debug.Assert(false); return null; // this should never be called for geometries } int ogrIndex = (int) m_fieldMapping[esriFieldsIndex]; if (!feature.IsFieldSet(ogrIndex)) return null; switch (feature.GetFieldType(ogrIndex)) { // must be kept in sync with utilities library case OSGeo.OGR.FieldType.OFTInteger: return feature.GetFieldAsInteger(ogrIndex); case OSGeo.OGR.FieldType.OFTReal: return feature.GetFieldAsDouble(ogrIndex); case OSGeo.OGR.FieldType.OFTString: return ogr_utils.ghetto_fix_ogr_string(feature.GetFieldAsString(ogrIndex)); case OSGeo.OGR.FieldType.OFTBinary: // WTF, the C# bindings don't have a blob retrieval until this ticket gets solved // http://trac.osgeo.org/gdal/ticket/4457#comment:2 return null; case OSGeo.OGR.FieldType.OFTDateTime: { int year, month, day, hour, minute, second, flag; feature.GetFieldAsDateTime(ogrIndex, out year, out month, out day, out hour, out minute, out second, out flag); DateTime date = new DateTime(year, month, day, hour, minute, second); return date; } default: return ogr_utils.ghetto_fix_ogr_string(feature.GetFieldAsString(ogrIndex)); //most things coerce as strings } }