spatialite - 如何在GPKG中使用spatialite创建带有几何列的表?
问题描述
我想用spatialite 创建一个矢量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
我做错了什么 ?
解决方案
推荐阅读
- java - 如何获得java数组列表的总和?
- pylint - 可以导入模块时pylint报无法导入错误
- python - /notify/ 'User' 对象的 AttributeError 没有属性 'get'
- regex - 是否可以为 Notepad++ 正则表达式指定 Unicode 类别类?
- c# - 通过 csv/txt 将数据(SQL Server 表)分发给第三方的方式 - 在用户输入后由 WHERE 子句过滤
- python - 在 Python 中修补嵌套对象
- string - PowerShell,管道兼容的 Select-String 函数
- sublimetext3 - 以日期和时间为自定义变量的 Sublime Text 3 片段
- sql - MERGE 语句在 Informix v10 中不起作用
- python - 使用 pip 命令将 matplotlib 和 Getfem 安装到 Python 3.9.0 时出错