5

I have a directory of GeoJSON files, which I want to load as layers into a single new GeoPackage file. According to the GDAL GeoPackage documentation, I can name my destination GeoPackage file, enter a directory of shapefiles as the source, and it will load them each as their own layer/table. Indeed, I've tested this with shapefiles, and it works.

When I try the same thing with GeoJSON files, however, I get this:

Unable to open datasource ./seattle_washington_osm with the following drivers.
   …
-> GeoJSON
   …

Is this simply not possible with GeoJSON files, or am I doing something wrong?

7

The "directory as dataset" is a specific feature of the shapefile driver. From http://www.gdal.org/drv_shapefile.html :

Normally the OGR Shapefile driver treats a whole directory of shapefiles as a dataset, and a single shapefile within that directory as a layer. In this case the directory name should be used as the dataset name. However, it is also possible to use one of the files (.shp, .shx or .dbf) in a shapefile set as the dataset name, and then it will be treated as a dataset with one layer.

Alternative approaches would be to load each file using a loop, or to convert to shapefiles first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.