I have an file that is in the format .osm.pbf
. It's about 8GB. I want to convert it to a feature class and place it in a file geodatabase. From what I can see, the simplest way to do that is using gdal
and ogr2ogr
. I had both installed with my OSGeo/QGIS. The gdal
and ogr2ogr
package files and executables are in my C:\OSGeo4W64\bin
folder. Initially, I tried converting to a shapefile
but ran into problems. I tried running the following command:
ogr2ogr -f "ESRI Shapefile" mydata.shp mydata.osm.pbf
I immediately got the following error messages:
Warning 1: Cannot find osmconf.ini configuration file
ERROR 1: Could not parse configuration file for OSM import
FAILURE:Unable to open datasource `na_test.osm.pbf' with the following drivers.
-> `JP2ECW'
-> `OCI'
...
-> `OSM'
I see that I have an 'OSM' driver, but it seems that either a) I don't have osmconf.ini
or its in the wrong spot, or b) I need to configure something in osmconf.ini
so that it can open a .osm.pbf
file. I do have a osmconf.ini
, but its in my C:\OSGeo4W64\share
folder. I tried copying it and placing it in 'binbut that didn't seem to do any good. My system variable path is pointing to 'C:\OSGeo4W64\bin
. In addition to this, I realized that there is no way I am converting 8GB + osm
files into a shapefile
and I need to convert them to feature classes or geojson if possible. Help, is there a way to do this? Is ther something wrong with my gdal configuration?
Side Note: I do have gdal and ogr2ogr working in a Python 3.x
environment with Pandas/Geopandas
.
Best Answer
It should find the osmconf.ini local to the installation. You can override it using
-oo CONFIG_FILE=<yourpath>/osmconf.ini
on the command line.You are probably also going to want to adjust your osmconf.ini to specify what is imported and what ignored. Also, how to handle closed ways,etc.
Yes shapefiles would be a bad choice. As would GeoJSON. You think PBF is big? This is a compressed binary format: Wait until you see a GeoJSON equivalent!
You could look at spatialite as one alternative. Also if you are serious about 8GB compressed files, then PostGIS should be seriously considered. Of course it all depends on what you are trying to do with the data.
Also note that the data is going to be imported with one 'layer' for each geometry type (point, linestring, etc) and not by feature type (road, river, etc).