2

I have a large geopackage file (15gb) for which I'd like to see the attribute (/field/column) names. Is this possible without loading the whole file?

Edit: It would be ideal if there was a command line tool that allowed you to do this. Something like just seeing the 'head' of the file

0

3 Answers 3

5

Use ogrinfo, e.g.:

ogrinfo -so <path/to/file.gpkg> <layer_name>
1

One cumbersome way to do this would be to convert to (something like) geojson using ogr2ogr, and then look at the head of the file. E.g.

ogr2ogr -f "GeoJSON"  <geojson_file_name> <geopackage_file_name>

Then once that's done, look at the top lines:

head -100 <geojson_file_name>

This would show the field names as geojson features.

This did the trick for me, but there's probably a format that would make more sense to convert to than geojson. And a more efficient way of doing things that doesn't require converting the geopackage to something else.

1
  • You ideally can create a connection to the geopackage and then use DB manager to inspect the table structure. Commented Apr 20, 2019 at 10:15
1

DBManager in QGIS can connect to the GeoPackage and show data structure as well as preview the data. Layers within the package can also be deleted.

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.