-
-
Notifications
You must be signed in to change notification settings - Fork 283
Read geopackage (.gpkg) geographic data
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
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.
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.
A careful editing of existing rows and columsn should work just fine, as long as you don't touch the primary key (fid) or geometry (geom) columns. Inserting new rows would require a solid understanding of how to encode geometry as well known binary, and avoiding all the pit falls (correct geometry type, correct coordinate system and so on). We highly recomend to us another tool such as QGIS for editing geopackage files.