Skip to content

Read geopackage (.gpkg) geographic data

Jan Kristian Jensen edited this page May 11, 2022 · 5 revisions

Geopackage is a modern, ligth weight and popular format for geographical data, mantained by the Open Geospatial Consortium. A geopackage file is a sqlite database file with some special tables, so any tool with sqlite support can read geopackage (*.gpkg) files. For visidata, simply append the --filetype sqlite argument like so:

vd FILENAME.gpkg --filetype sqlite

Don't let all the other tables confuse you

Below is a screen shot opening a geopackage file containing one single table, named myInterestingData. All other tables are geographical metadata and indexes. These are nescessary to extend a regular sqlite file into a geopackage file. Most tools with geopackage support will hide these tables from the end user.

image

Any table starting with gpkg, rtree*, rtree*, trigger* and the table sqlite_sequence do NOT contain the tabular data you're looking for, and should be ignored (unless you have a curious mind and want to poke around). In that case, the table geopackage_contents may be a good place to start poking.

Here's a screenshot of actual tabular data. The first two columns, fid# and geom, are the geopackage primary key and geometry, which is all binary and therefore just look like noise in visidata. The actual tabular data - i.e. the properties of all the geographic features - are readable.

image

Writing data - probably not

A careful editing of existing rows should work just fine, as long as you don't touch the

Clone this wiki locally