4

I am using the OSGeo4W shell to call ogrinfo on a directory (geodata) to see what vector files it includes:

enter image description here

As you see, it lists two shapefiles and it tells me that it is using the shapefile driver; I assume that is the default driver.

However, my folder includes a KML and a GeoJSON as well.

How would I go about including vector files other than shapefiles in the output as well?

2 Answers 2

5

ogrinfo is meant to be used on single datasets. GDAL's Shapefile driver "treats a whole directory of shapefiles as a dataset, and a single shapefile within that directory as a layer" but that really is a shapefile speciality. If you want show the ogrinfo output for multiple files, maybe including subdirectories, you will have to use a small tool/script to loop through them one by one.

5

Directory of shapefiles is a special case for GDAL/OGR and it behaves like a datastore with many layers as you have noticed. As far as I know no other driver has similar behavior. You can test all files in the directory on Windows as

for %1 in (*.*) do ogrinfo %1 >>total_ogrinfo.txt

The total_ogrinfo.txt file may contain lots of messages like

FAILURE: Unable to open datasource `foo.doc' with the following
drivers.
-> netCDF 
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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