I'm using the GDAL .Net library to open a PBF file I've downloaded from the GeoFabrik website. The file opens fine in QGIS.
However when I call the Gdal.Open method on the file, it throws an exception stating:
System.ApplicationException: '`south-africa-and-lesotho-latest.osm.pbf' not recognized as a supported file format.'
GdalConfiguration.ConfigureGdal(); var data = Gdal.Open("C:/south-africa-and-lesotho-latest.osm.pbf", OSGeo.GDAL.Access.GA_ReadOnly);
I find this weird since, when the ConfigureGdal method is called, it prints out a list of drivers to the output window, one of them being OSM PBF:
GDAL 180: PGDUMP-PostgreSQL SQL dump
GDAL 181: OSM-OpenStreetMap XML and PBF
GDAL 182: GPSBabel-GPSBabel
I've made some changes to the GdalConfiguration class that gets created when installing the GDAL Nuget package. These changes include adjusting the directories to set the correct gdal data and driver directory, as well as setting the osminfo.ini config file.
The problem is, I don't actually know what those directories should contain to know for certain I've chosen the right ones.