[gdal-dev] C# OGR reading OSM features "stalls"

agerrius arno at agerrius.nl
Sun Mar 2 06:47:37 PST 2014


Hi all,

I'm using the OGR libraries from a C# application to read OSM data. But I
have a problem now, with a certain file the reading of the features
"stalls". It seems GetNextFeature() never returns anything.

When I use ogrinfo -al on the same file it also seems to stall (probably at
the same point, but not sure about that).

Using this simple code I can reproduce the issue, it stops after 19404
features being read:

            Ogr.RegisterAll();
            DataSource ds =
Ogr.Open(@"C:\flightsim\work\nantucket\source\geo\osm\nantucket.osm", 0);
            for (int i = 0; i < ds.GetLayerCount(); i++)
            {
                Layer lay = ds.GetLayerByIndex(i);
                Console.WriteLine("Reading layer " + lay.GetName());
                int count = 0;
                Feature feat = lay.GetNextFeature();
                while (feat != null)
                {
                    Console.WriteLine("feature " + count);
                    count++;
                    feat = lay.GetNextFeature();
                }
                Console.WriteLine(String.Format("Contains {0} features",
count));
            }

The OSM file was extracted from a bigger file using osmosis, not sure if
that could be part of the issue. I have uploaded the OSM file for testing:

http://www.scenerydesign.org/tmp/nantucket.zip

Is there anything I'm doing wrong here? If the file had some issue I would
expect to get an error thrown.

Thanks,

Arno



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/C-OGR-reading-OSM-features-stalls-tp5106937.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list