[Qgis-user] Open geometryless tables from GeoPackage
Even Rouault
even.rouault at spatialys.com
Thu Apr 28 01:29:34 PDT 2016
Le jeudi 28 avril 2016 07:03:45, Stefan Ziegler a écrit :
> Yes, compiled and running against gdal master.
>
> Do you just drag 'n' drop the geopackage file into QGIS? Do you mind trying
> this one: http://sogeo.services/tmp/av_2495.gpkg
>
> I checked it with "ogrinfo -so av_2495.gpkg" and it only shows the tables
> with geometry (gdal 1.11 and gdal master).
Stefan,
OK, I see. This database hasn't been produced by GDAL. GDAL only produces
and recognizes non-spatial tables that conform to http://gdal.org/geopackage_aspatial.html ,
which is a GDAL-specific extension that was created to address the support of
such tables : https://trac.osgeo.org/gdal/ticket/5521 ,
http://lists.opengeospatial.org/pipermail/geopackage/2014-June/thread.html#22
You can upgrade your DB to aspatial by doing the following :
$ sqlite3 av_2495.gpkg
INSERT INTO gpkg_contents (table_name, data_type, last_change)
SELECT name, 'aspatial', strftime('%Y-%m-%dT%H:%M:%fZ', 'now' ) FROM
sqlite_master WHERE type = 'table' AND name NOT LIKE 'gpkg_%' AND
name NOT LIKE 'sqlite_%' AND name NOT LIKE 'rtree_%' AND
name NOT IN (SELECT table_name FROM gpkg_contents);
INSERT INTO gpkg_extensions
(table_name, column_name, extension_name, definition, scope)
VALUES
(
NULL,
NULL,
'gdal_aspatial',
'http://gdal.org/geopackage_aspatial.html',
'read-write'
);
The original point for the aspatial extension was to be compatible with requirements from metadata,
but the latest revision of the GPKG spec has demoted metadata support itself as an extension.
So perhaps GDAL could be more lax on opening.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the Qgis-user
mailing list