如何在带有spacespaceite的GPKG中使用几何列创建表?

时间:2019-05-03 07:20:07

标签: spatialite geopackage

我想用spacespaceite创建矢量GPKG。

借助文档(此处为http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p16gpkg),我创建了一个sql脚本,如下所示:

SELECT EnableGpkgMode();
SELECT gpkgCreateBaseTables();

CREATE TABLE grid ('fid' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT);
SELECT gpkgAddGeometryColumn('grid', 'geom', 'GEOMETRY', 0, 0, 4326);

这是我的输出:

$ rm -f test.gpkg && spatialite test.gpkg < test.sql
SpatiaLite version ..: 4.3.0a   Supported Extensions:
    - 'VirtualShape'    [direct Shapefile access]
    - 'VirtualDbf'      [direct DBF access]
    - 'VirtualXL'       [direct XLS access]
    - 'VirtualText'     [direct CSV/TXT access]
    - 'VirtualNetwork'  [Dijkstra shortest path]
    - 'RTree'       [Spatial Index - R*Tree]
    - 'MbrCache'        [Spatial Index - MBR cache]
    - 'VirtualSpatialIndex' [R*Tree metahandler]
    - 'VirtualElementary'   [ElemGeoms metahandler]
    - 'VirtualXPath'    [XML Path Language - XPath]
    - 'VirtualFDO'      [FDO-OGR interoperability]
    - 'VirtualGPKG' [OGC GeoPackage interoperability]
    - 'VirtualBBox'     [BoundingBox tables]
    - 'SpatiaLite'      [Spatial SQL - OGC]
PROJ.4 version ......: Rel. 5.2.0, September 15th, 2018
GEOS version ........: 3.7.1-CAPI-1.11.1 27a5e771
TARGET CPU ..........: x86_64-linux-gnu
the SPATIAL_REF_SYS table already contains some row(s)


Error: near line 5: FOREIGN KEY constraint failed

我做错了什么?


在这里回答:https://gis.stackexchange.com/questions/321596/how-to-create-table-with-geometry-column-in-gpkg-with-spatialite

0 个答案:

没有答案