Hi GDAL devs,

I'm trying to support ESRI File Geodatabase support (read-only) in my iOS app 
and have recently got GDAL 1.11.0 compiled and running in the app for its new 
OpenFileGDB driver.  However, I've been unable to extract features from GDBs 
using the exact same code that works fine for other formats/drivers.

An extract of the code in question is:

------------------------
        ds = OGROpen(path, FALSE, NULL);
        layerCount = OGR_DS_GetLayerCount(ds);
        
        for ( int i = 0; i < layerCount; i++ )
        {
                OGRLayerH sourceLayer = OGR_DS_GetLayer(ds, i);
                int sourceFeatureCount = OGR_L_GetFeatureCount(sourceLayer, 
YES);

                for ( long j = 0; j < sourceFeatureCount; j++ )
                {
                        OGRFeatureH sourceFeature = 
OGR_L_GetFeature(sourceLayer, j);

                        if ( ! sourceFeature )
                                NSLog(@"Failed to get feature at index '%ld' 
from layer at index '%d'!", j, i);
------------------------

The NSLog line is always run for my GDB data sources but never for data sources 
of other formats.  So for GDB data sources 'sourceFeature' is always NULL and 
of course this causes all subsequent OGR functions to which 'sourceFeature' is 
passed to fail with errors like:

        ERROR 10: Pointer 'hFeat' is NULL in 'OGR_...'.

Using the CLI utility 'ogrinfo' (different build of GDAL) on the same 
datasource works fine showing all the features are there as expected and it 
works fine in ESRI ArcGIS.  And the fact that it gets into the second 'for' 
loop at all indicates that there are features there, and yet it cannot get the 
feature at index '0'.

The File Geodatabase datasource can be downloaded for testing from:

        https://dl.dropboxusercontent.com/u/12436846/Bandicoots.gdb.zip

Can anybody advise me on how I should trouble shoot this further, or how the 
problem can be resolved?

Cheers,
Nik.

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to