Open Geospatial Consortium

发布日期: 2014-02-12
通过日期: 2014-01-19
提交日期: 2013-10-13
本 OGC® 文档的外部标识: http://www.opengis.net/doc/IS/geopackage/1.0
本 OGC® 文档的编号: OGC 12-128r10
版本: 1.0
类别: OGC® Encoding Standard
编者: Paul Daisey

OGC® GeoPackage 标准

Copyright © 2014 Open Geospatial Consortium.
查看额外的使用权利, 请访问 http://www.opengeospatial.org/legal/

Warning

This document is an OGC Member approved international standard. This document is available on a royalty free, non-discriminatory basis. Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.

Document type: OGC® Publicly Available Standard
Document subtype: Encoding Standard
Document stage: Approved
Document language: English

中文翻译说明

本文档是对OGC GeoPackage资料库 (https://github.com/opengis/geopackage) 完整的中文翻译,便于中文传播。 除本小结(中文翻译说明)外,都基于GeoPackage规范原文忠实翻译,未对GeoPackage原文的意思做任何增、删、变动。

该规范的英文HTML版本(原版)可在地址 http://www.geopackage.org/spec/ 中得到。

GeoPackage规范的版权和知识产权都属于OGC。

参与本GeoPackage规范中文版本翻译的组织有:SuperMap

本GeoPackage规范中文版本翻译的主要贡献者如下:

姓名 组织 负责章节 Email

曹利平

SuperMap

1,2.1.1-2.1.4, 2.2.7-2.2.8, 2.3

caoliping@supermap.com

孙笑玉

SuperMap

2.1.5-2.1.6, 2.2.1-2.2.6

sunxiaoyu@supermap.com

谷永权

SuperMap

2.5

guyongquan@supermap.com

周世杰

SuperMap

3.2,4

zhoushijie@supermap.com

苏乐乐

SuperMap

2.4, 3.1

sulele@supermap.com

许可说明

Permission is hereby granted by the Open Geospatial Consortium, ("Licensor"), free of charge and subject to the terms set forth below, to any person obtaining a copy of this Intellectual Property and any associated documentation, to deal in the Intellectual Property without restriction (except as set forth below), including without limitation the rights to implement, use, copy, modify, merge, publish, distribute, and/or sublicense copies of the Intellectual Property, and to permit persons to whom the Intellectual Property is furnished to do so, provided that all copyright notices on the intellectual property are retained intact and that each person to whom the Intellectual Property is furnished agrees to the terms of this Agreement.

If you modify the Intellectual Property, all copies of the modified Intellectual Property must include, in addition to the above copyright notice, a notice that the Intellectual Property includes modifications that have not been approved or adopted by LICENSOR.

THIS LICENSE IS A COPYRIGHT LICENSE ONLY, AND DOES NOT CONVEY ANY RIGHTS UNDER ANY PATENTS THAT MAY BE IN FORCE ANYWHERE IN THE WORLD.

THE INTELLECTUAL PROPERTY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE DO NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE INTELLECTUAL PROPERTY WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE INTELLECTUAL PROPERTY WILL BE UNINTERRUPTED OR ERROR FREE. ANY USE OF THE INTELLECTUAL PROPERTY SHALL BE MADE ENTIRELY AT THE USER’S OWN RISK. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY CONTRIBUTOR OF INTELLECTUAL PROPERTY RIGHTS TO THE INTELLECTUAL PROPERTY BE LIABLE FOR ANY CLAIM, OR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM ANY ALLEGED INFRINGEMENT OR ANY LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR UNDER ANY OTHER LEGAL THEORY, ARISING OUT OF OR IN CONNECTION WITH THE IMPLEMENTATION, USE, COMMERCIALIZATION OR PERFORMANCE OF THIS INTELLECTUAL PROPERTY.

This license is effective until terminated. You may terminate it at any time by destroying the Intellectual Property together with all copies in any form. The license will also terminate if you fail to comply with any term or condition of this Agreement. Except as provided in the following sentence, no such termination of this license shall require the termination of any third party end-user sublicense to the Intellectual Property which is in force as of the date of notice of such termination. In addition, should the Intellectual Property, or the operation of the Intellectual Property, infringe, or in LICENSOR’s sole opinion be likely to infringe, any patent, copyright, trademark or other right of a third party, you agree that LICENSOR, in its sole discretion, may terminate this license without any compensation or liability to you, your licensees or any other party. You agree upon termination of any kind to destroy or cause to be destroyed the Intellectual Property together with all copies in any form, whether held by you or by any third party.

Except as contained in this notice, the name of LICENSOR or of any other holder of a copyright in all or part of the Intellectual Property shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Intellectual Property without prior written authorization of LICENSOR or such copyright holder. LICENSOR is and shall at all times be the sole entity that may authorize you or any third party to use certification marks, trademarks or other special designations to indicate compliance with any LICENSOR standards or specifications.

This Agreement is governed by the laws of the Commonwealth of Massachusetts. The application to this Agreement of the United Nations Convention on Contracts for the International Sale of Goods is hereby expressly excluded. In the event any provision of this Agreement shall be deemed unenforceable, void or invalid, such provision shall be modified so as to make it valid and enforceable, and as so modified the entire Agreement shall remain in full force and effect. No decision, action or inaction by LICENSOR shall be construed to be a waiver of any rights or remedies available to it. None of the Intellectual Property or underlying information or technology may be downloaded or otherwise exported or reexported in violation of U.S. export laws and regulations. In addition, you are responsible for complying with any local laws in your jurisdiction which may impact your right to import, export or use the Intellectual Property, and you represent that you have complied with any regulations or registration procedures required by applicable law to make this license enforceable.

专利请求

Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. The Open Geospatial Consortium Inc. shall not be held responsible for identifying any or all such patent rights.

Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by any implementation of the standard set forth in this document, and to provide supporting documentation.

摘要

OGC® 编码标准定义了用于数据交换的GeoPackage协议,定义了GeoPackage SQLite扩展用于在多种比例尺级别直接使用矢量地理空间要素信息,以及地球影像、栅格地图的瓦片矩阵集合。直接使用意味着有能力以原生(native)的格式访问和更新数据,而不需要中间格式转换(例如,通过API),这样能确保数据模型和数据集的完整性,以及在对来自各个不同的客户端的请求进行响应时,返回完全相同的访问、更新结果。GeoPackage不论在企业级还是在个人计算机环境中都支持互操作,而当通讯连接不稳定、带宽有限时,对移动设备(例如手机、平板电脑)格外有用。

关键字

ogcdoc, geopackage, sqllite, raster, tiles, vector, feature, data, storage, exchange, mobile, smartphone, tablet

Table of Contents

介绍

移动设备用户在网络连接中断或是受限的环境下,获取和操作地图/地理信息服务时会遇到一些挑战,一是存储能力有限,另外也缺乏开放的空间数据格式来支持移动应用。目前的情况是,每个地图/地理信息应用都可能有自己专有的地理数据库,这些专有的地理数据库可能包含相同的地理数据,这样就造成了可用存储空间的浪费(移动设备的存储空间往往是有限的),当地理数据在不同的地图/地理信息应用之间按同一视图共享时,还要求应用程序进行定制以适应地理数据转换、复制和同步的需求。此外,许多现有的地理数据库是与平台绑定的,这就意味着不同平台的用户在共享数据时必须进行转换。

为了克服这些挑战,有效地支撑多样的地图/地理信息应用(例如固定产品分发、本地数据收集、地理空间分析),我们需要开放的Geopackage(GPKG)数据容器、API和清单,它们需要是基于标准的、独立于应用程序的、独立于平台的、轻便的、可互操作的、以及自描述的。 考虑到移动手持设备缺乏足够的处理能力和电量寿命来有效地处理复杂的地理产品的生产和分析任务,本标准期望使GeoPackage在COTS(Commercial-off-the-shelf,商用现成品)以及开源软件中得到广泛采纳和使用,不仅应用到企业级生产平台中,更重要的是应用到移动手持设备中[B1] [B2]。 通过接入GPKG文件,应用程序能充分利用GPKG的特性,当前很少有程序能充分利用所有的GPKG特性。

OGC® 编码标准定义了用于数据交换的GeoPackage协议,定义了GeoPackage SQLite扩展用于在多种比例尺级别直接使用矢量地理空间要素信息,以及地球影像、栅格地图的瓦片矩阵集合。直接使用意味着有能力以原生(native)的格式访问和更新数据,而不需要中间格式转换(例如,通过API),这样能确保数据模型和数据集的完整性,以及在对来自各个不同的客户端的请求进行响应时,返回完全相同的访问、更新结果。

GeoPackage是一个独立于平台的SQLite [5]数据库文件,它包含了GeoPackage数据和元数据表(如GeoPackage 表概述 所示),这些内容有详细的规则定义,完整的声明,格式限制和内容约束。GeoPackage 允许的内容在本文档中进行了完整的定义。

扩展的GeoPackageGeoPackage基础上包含了额外的数据要素(表或列)或SQL结构(数据类型、方法、索引、约束或触发器),这些额外的数据要素或SQL结构在本编码规范中没有指定。

GeoPackage 可能为“空”(矢量要素和(或)瓦片矩阵金字塔对应的数据表中没有记录),也可能包含一个或多个矢量要素类型的记录,以及一个或多个瓦片金字塔(tile matrix pyramid)类型的影像瓦片。GeoPackage元数据能够描述GeoPackage的数据内容,以及确定同步外部数据时的源和目标。 GeoPackage可能包含几何要素的空间索引,以及用于维护索引、确保内容约束的SQL触发器(triggers)。

Geopackage SQLite配置项由SQLite 3软件库和一组编译和运行时的配置项组成。

Geopackage SQLite 扩展是一个支持SQLite加载的扩展项,可能提供SQL功能[12] 以支持空间索引和SQL触发器,SQL触发器与确定配置需求的SQLite库关联,为访问GeoPackage文件提供SQL API[1] [2] [3] [4]。 本标准不解决背景说明 (规范性的)潜在的未来工作 (资料性的)条款的问题,它们可能在本规范的后续版本或其他规范中解决。

GeoPackage Tables
Figure 1. GeoPackage 表概述

1. 基础

可选项中所做的规定以及已注册的扩展中指定的扩展展示了本规范具备的功能。所有以gpkg_*开头的表、视图,以及本标准中指定的存储瓦片的用户数据表,都应该只有规定的列和表约束。存储要素的用户数据表中除了有这些规定的列,还可能有其他列。本标准中所有的表名和列名都应该使用小写。

1.1. 核心

每个GeoPackageGeoPackage SQLite都应该实现附属条款中定义的核心功能以及本条款中的需求陈述。

1.1.1. SQLite 容器

SQLite软件库提供了一个自包含的、单文件、跨平台的、服务器无关的、事务性的、开源的RDBMS(关系数据库管理系统)容器。 为了使用SQLite软件库,GeoPackage规范定义了一个SQL数据库schema。 使用SQLite作为GeoPackage的基础简化了GeoPackage文件的生产、分发和使用,同时确保了Geopackage文件中的数据完整性。

“自包含”是指容器软件几乎不需要外部库或操作系统的支持。 “单文件”是指在支持文件系统的计算平台中,容器在没有被任何软件打开时,在一个文件系统中只由一个独立文件构成。 “跨平台”指的是一个计算平台中创建和装载数据的容器文件,可能在另一个平台中被使用和更新,即使这两个平台位于不同的操作系统、文件系统甚至有不同的字节顺序(endian)约定。 “服务器无关”指的是RDBMS容器的实现不需要任何中间服务器进程,就能被应用软件直接访问。 “事务性”是指在程序崩溃、操作系统崩溃以及断电的情况下,RDBMS仍能确保对容器内数据的所有修改都具备 原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)和持久性(Durability)。

1.1.1.1. 数据
1.1.1.1.1. 文件格式
Requirement 1
一个GeoPackage应该是一个 SQLite [5]数据库文件,该数据库文件应使用 3.x版本的SQLite文件格式 [6] [7]。 GeoPackage文件用ASCII格式 [B4]打开的前16个字节应该包含“SQLite format 3” [1] 字符串。 [2]
Requirement 2
GeoPackage的SQLite数据库头(header)中,平台ID(application id)字段应该包含0x47503130(ASCII转码后为“GP10”)来表明文件为GeoPackage 1.0版本。[3]

GeoPackage的最大存储空间约为140TB。在实际应用写文件的时候,因受到文件系统的影响,存储空间可能更小。很多移动设备的外部存储卡需要使用FAT32格式化,而FAT32文件系统也限制了GeoPackage单个文件的最大存储空间为4GB。

1.1.1.1.2. 文件扩展名
Requirement 3
GeoPackage文件的扩展名为“*.gpkg”。

推荐扩展的GeoPackage文件使用扩展名“*.gpkx”,但GeoPackage规范并不做规定。

1.1.1.1.3. 文件内容
Requirement 4
GeoPackage文件应该只包含数据要素、SQL元素、以及GeoPackage扩展,按照本标准要求,GeoPackage扩展应该带有“gpkg”作者名字。

为了保证应用程序之间最大的互操作性,GeoPackage文件不应包含本标准之外的数据要素(表或列)、SQL元素(数据类型,索引,约束或触发器)、以及扩展。 本规范中的扩展GeoPackage文件(Extended GeoPackages)是指SQLite数据库不仅使用了GeoPackage规范中规定的基本元素,还对这些元素进行了扩展。

Requirement 5
GeoPackage数据表中的列仅可以使用GeoPackage 数据类型中规定的数据类型进行声明。
Table 1. GeoPackage 数据类型
数据类型 大小与说明

BOOLEAN

标识true或false的布尔值,在SQLite中存储为INTEGER类型,0表示false,1表示true

TINYINT

8位补码表示的整数。在SQLite中存储为INTEGER类型,取值范围为[-128, 127]

SMALLINT

16位补码表示的整数。在SQLite中存储为INTEGER类型,取值范围为[-32768, 32767]

MEDIUMINT

32位补码表示的整数。在SQLite中存储为INTEGER类型,取值范围为[-2147483648, 2147483647]

INT, INTEGER

64位补码表示的整数。在SQLite中存储为INTEGER类型,取值范围为[-9223372036854775808, 9223372036854775807]

FLOAT

IEEE 32位浮点数。在SQLite中存储为REAL类型,取值需要能被4个字节的IEEE浮点数表示

DOUBLE, REAL

IEEE 64位浮点数。在SQLite中存储为REAL类型

TEXT{(maxchar_count)}

UTF-8或UTF-16编码的变长字符串,编码类型取决于PRAGMA encoding指令(参见:http://www.sqlite.org/pragma.html#pragma_encoding)。maxchar_count是可选的,它限定了字符串长度。如果未指定,则字符串长度是无限的。限制字符串长度是为了更好的表达信息,当字符串过长时,应用程序可能会把字符串截断。定义maxchar_count使应用程序能够根据字符串长度上限进行最佳处理。在SQLite中存储为TEXT类型

BLOB{(max_size)}

变长的二进制数据。max_size是可选的,它限定了数据的二进制长度。如果未指定,则长度是无限的。数据大小提供了信息参考。定义max_size使应用程序能够根据数据大小上限进行最佳处理。在SQLite中存储为BLOB类型

<geometry_type_name>

几何对象(Geometry)根据几何对象编码 进行编码。 <geometry type_name> 是符合2.1.3条款的几何对象类型 (规范性的)所列的其中一个几何类型,或是符合3.1.2条款和 用户自定义的几何类型编码扩展的模板 (规范性的)的用户自定义几何类型。XY、XYZ、XYM和XYZM类型的几何对象使用的是同一数据类型。在SQLite中存储为BLOB类型

DATE

ISO-8601标准的日期字符串,字符串格式为YYYY-MM-DD,使用UTF-8或UTF-16编码。参见TEXT类型。在SQLite中存储为TEXT类型

DATETIME

ISO-8601标准的日期/时间字符串,字符串格式为YYYY-MM-DDTHH:MM:SS.SSSZ,T用作分隔符,后缀Z表示DATETIME为协调世界时(UTC),字符串使用UTF-8或UTF-16编码。参见TEXT类型。在SQLite中存储为TEXT类型

1.1.1.1.4. 文件完整性
Requirement 6
对GeoPackage文件中运行SQLite的PRAGMA integrity_check命令,应该返回“ok”。
Requirement 7
对GeoPackage文件中运行SQLite的PRAGMA foreign_key_check命令,不传参数时应该返回空的结果集,表示该GeoPackage文件的所有外键(foreign key)都有效。
1.1.1.2. API
1.1.1.2.1. 结构化查询语言(SQL)
Requirement 8
GeoPackage的SQLite配置应该通过 SQLite 3.x版本 [6] 的软件API,提供对GeoPackage内容的SQL访问方式。[4]
1.1.1.2.2. 每个GPKG的SQLite配置

SQLite [8] 库有许多http://www.sqlite.org/compile.html[编译]和http://www.sqlite.org/pragma.html[运行] 时参数,在针对不同用途配置SQLite时可能被使用。 GeoPackage规范中的元素在运行时依赖于SQLite功能的可用性,本条款规定了编译和运行时,哪些参数可以使用,哪些参数不允许使用。

Requirement 9
每个GeoPackge的SQLite配置都应该符合每个GeoPackage的SQLite配置中指定的SQLite编译和运行时参数说明。
Table 2. 每个GeoPackage的SQLite配置
Setting 参数 应该 / 不应该 Discussion

compile

SQLITE_OMIT_*

不应该

不应该包括任何 http://www.sqlite.org/compile.html#omitfeatures 中的OMIT参数

run

PRAGMA foreign_keys

不应该 (关闭)

外键约束用来维持GeoPackage引用的完整性

1.1.2. 空间参考系统

1.1.2.1. 数据
1.1.2.1.1. 表的定义
Requirement 10
GeoPackage应该包含一个gpkg_spatial_ref_sys表,gpkg_spatial_ref_sys表必须符合 1.1.2.1.1 表的定义、表 空间参考系统表的定义 和表gpkg_spatial_ref_sys Table Definition SQL的规定。

gpkg_spatial_ref_sys是标准SQL schema中描述简单要素(参见下面的简单要素的SQL介绍 条款)的第一个部分。它包含的坐标参考系定义被GeoPackage的gpkg_contentsgpkg_geometry_columns表引用,来将用户表中的矢量、瓦片数据与地球上的真实位置联系起来。

gpkg_geometry_columns表包含了SQL/MM (ISO 13249-3) [12]中规定的最少列,如下面的表空间参考系统表的定义 所示,这些列包含了定义空间参考系所需的数据。 这个表的视图(Views)被用来使 SQL/MM [12] (参见 表SQL/MM View of gpkg_spatial_ref_sys Definition SQL (Informative))和OGC Simple Features SQL [9][10][11] (Table 21) 规范保持兼容。

Table 3. 空间参考系统表的定义
Column Name Column Type Column Description Null Key

srs_name

TEXT

空间参考系统(SRS)的名称

no

srs_id

INTEGER

GeoPackage中,SRS的唯一ID

no

PK

organization

TEXT

定义SRS的组织的名称(不区分大小写),例如EPSG 或 epsg

no

organization_coordsys_id

INTEGER

organization组织分配SRS数字ID

no

definition

TEXT

描述SRS的Well-known Text(WKT) [32]

no

description

TEXT

SRS的描述

yes

1.1.2.1.2. 表数据的取值

表gpkg_spatial_ref_sys中,表示WKT值的列应该定义几何要素和栅格瓦片所使用的空间坐标系(SRS),当SRS未知时表示为 undefined(参见Requirement 11)。WKT的值应该由[32] 条款7中指定的EBNF(扩展的BN范式)语句构成,应该包含可选的<authority> EBNF 实体,非WGS-84的WKT值应该包含可选的 <to wgs84> EBNF 实体。WKT值可以省略可选的 <to wgs84> 和 <twin axes> EBNF 实体。从任何具体的<authority>(比如[13][14]),都可以获取EBNF的名称和数值。例如,通过[spatial_ref_sys_data_values_default]测试方法的第(3)步的返回值,就可以测试WGS-84的定义,WGS-84的定义参见Requirement 11

Requirement 11
GeoPackage中的表gpkg_spatial_ref_sys应该包含至少3条记录,一条记录表示 WGS-84 [15]坐标系,该记录的organization为http://www.epsg.org/Geodetic.html[EPSG] 或 epsg [B3]organization_coordsys_id4326 [13][14];一条记录表示未定义的笛卡尔坐标系,该记录的srs_id值为-1,organization值为“NONE”,organization_coordsys_id值为-1,definition值为“undefined”;一条记录表示未定义的地理坐标系,该记录的srs_id值为0,organization值为“NONE”,organization_coordsys_id值为0,definition值为“undefined”
Requirement 12
GeoPackage中的表gpkg_spatial_ref_sys应该包含Geopackage中的要素和瓦片用到的所有空间坐标系。

1.1.3. 内容

1.1.3.1. 数据
1.1.3.1.1. 表定义
Requirement 13
GeoPackage应该包含一个gpkg_contents表,gpkg_contents表必须符合表 内容表或视图的定义 和表gpkg_contents Table Definition SQL的规定。

Geopackage中的空间数据是可访问和(或)更新的,表gpkg_contents的目的就是提供具有可识别性和描述性的信息,以便于应用程序将这些数据以更直观简洁的方式在用户面前展示出来。

Table 4. 内容表或视图的定义
列名 类型 描述 Null 默认值 Key

table_name

TEXT

瓦片或要素表的名字

no

PK

data_type

TEXT

存储在表中的数据类型,“features”表示要素类型,“tiles”表示瓦片类型,或是一个自定义值,表示扩展的Geopackage中其他类型的数据

no

identifier

TEXT

table_name的内容标识符(如短名称)

yes

description

TEXT

table_name的内容描述

yes

“”

last_change

DATETIME

ISO 8601格式的时间戳,格式为%Y-%m-%dT%H:%M:%fZ,可通过strftime函数获取当前时间。

no

strftime('%Y-%m-%dT%H:%M:%fZ', 'now')

min_x

DOUBLE

table_name表中所有数据的边界框的最小 x 值

yes

min_y

DOUBLE

table_name表中所有数据的边界框的最小 y 值

yes

max_x

DOUBLE

table_name表中所有数据的边界框的最大 x 值

yes

max_y

DOUBLE

table_name表中所有数据的边界框的最大 y 值

yes

srs_id

INTEGER

空间参考系ID:参见gpkg_spatial_ref_sys.srs_id; 当data_type 为features时,应该与gpkg_geometry_columns.srs_id匹配;当data_type为tiles时, 应该与gpkg_tile_matrix_set.srs_id匹配。

yes

FK

gpkg_contents的目的是提供GeoPackage文件中所有地理空间数据的列表。 data_type列指定了地理空间数据的类型。 Bounding box(min_x, min_y, max_x, max_y)提供了详实的边界框(而不是必要的最小边界)。 当srs_id列的值表示的是地理坐标系(CRS)时,边界框的min/max x/y值的单位是度;当srs_id列的值表示的时投影坐标系(CRS)时,边界框的min/max x/y值的单位由该坐标系决定。

1.1.3.1.2. 表中数据值
Requirement 14
gpkg_contentstable_name列的取值应该是一个SQLite表名或视图名。
Requirement 15
gpkg_contentslast_change列的取值应该符合 ISO 8601 [29] 规范,应该是一个包含UTC 小时, 分钟, 秒,以及秒的小数部分的完整的日期字符串,并应该带有‘Z’ (‘zulu’)后缀来标识时间为协调世界时(UTC)。[5]
Requirement 16
gpkg_contentssrs_id列的值应该与表gpkg_spatial_ref_syssrs_id列的值对应。

2. 可选项

本章节中描述的可选要求都依赖于上述基础章节中定义的必选要求。 本章节中的每个子条款都是能在GeoPackage中使用的独立功能模块。这些模块是可选的。 GeoPackage中可以使用一个或多个本章节中定义的可选模块,没有被使用的可选表可以忽略。 但GeoPackage文件中至少要包含一个要素数据表或瓦片数据表,它们各自要符合要素瓦片的定义。

Requirement 17
在GeoPackage中,应该包含由要素定义的要素和(或)由瓦片定义的瓦片,并且在gpkg_contents表中应该包含描述用户数据表的记录,这些记录的data_type列的值应为小写的“features”或“tiles”。

2.1. 要素

2.1.1. 简单要素的SQL介绍

矢量要素数据表达具有地理位置信息的地物,包括类似行政区划的概念对象,诸如道路、河流的现实对象,以及它们包含的具体信息。 在通过关系型数据库的SQL语句存储、访问和使用地理空间要素/几何对象方面,已经有许多国际标准[9][10][11][12] 。 在GeoPackage文件中,表gpkg_spatial_ref_sys是SQL schema中描述矢量要素的第一个部分,参见空间参考系统一节。 SQL schema中描述矢量要素的其他部分定义如下。

GeoPackage中,“简单”要素是通过 SQL/MM (ISO 13249-3) [12]几何模型中的线性几何子集来表达的,如下图 核心几何模型 所示。

Core geometry model
Figure 2. 核心几何模型

这个标准对具体的(非抽象的)几何对象类型做了限制,必须为2,3或4维坐标空间(R2,R3和R4)中的0,1或2维二维对象。 R2中的几何对象的点拥有x和y坐标。 R3中的几何对象的点拥有x、y、z坐标,或x、y、m坐标。 R4中的几何对象的点拥有x、y、z和m坐标。 真实坐标由点所属的坐标系决定。 几何对象中的所有点应该属于同一个坐标系。

几何要素可包括z坐标值。Z表示传统上的第三个维度(例如,3D)。 在地理信息系统(GIS)中,通常是指海拔高度。 例如,在地图中可以使用x、y值来表示一座山峰在地球上的位置,使用z值来表示这座山峰的高度。

几何要素可包括m坐标值。 m值在实际应用中,表示与参考点的距离。 例如,一个水系网可以被表示为具有m坐标的多线性值,m值表示当前位置距水源头的距离。

根据本标准中几何类型的定义,所有的几何对象都必须是拓扑闭合的, 例如,所有的几何对象都有拓扑边界,边界用点集合表示。这并不影响它们的表达, 在其他应用场景下(例如拓扑展现),可以使用同样类型的开放版本。

每种几何类型的简要说明如下,更详细的说明可在更详细的说明可参见ISO 13249-3 [12]

  • Geometry: 几何类型继承关系的根。

  • Point:在空间中的一个位置。每个点都有一个X和Y坐标。点可以选择包含一个Z和/或M值。

  • Curve:所有1维几何类型的基本类型。1维几何要素是有长度但没有面积的几何要素。 Curve如果不与自身相交(在起点和终点除外),则认为它是简单曲线。 当曲线的起点和终点重合,则认为它是闭合曲线。 一个简单、闭合的curve(曲线)被称为环(ring)。

  • LineString: 在空间连接两个或多个点的曲线。

  • Surface: 面,所有2维几何类型的基本类型,2维几何类型是一种具有面积的几何类型。

  • CurvePolygon:由一个外环和零个或多个内环所组成的平面。每个环都是曲线(Curve)类型的。

  • Polygon: 当CurvePolygon中的每个环都是简单、闭合的LineString类型时,它被称为Polygon。

  • GeometryCollection: 零个或多个几何对象的集合。

  • MultiSurface: GeometryCollection中的每个几何对象都是Surface类型时,它被称为MultiSurface。

  • MultiPolygon: GeometryCollection中的每个几何对象都是Polygon类型时,它被称为MultiPolygon。

  • MultiCurve: GeometryCollection中的每个几何对象都是Curve类型时,它被称为MultiCurve。

  • MultiLineString: GeometryCollection中的每个几何对象都是LineString类型时,它被称为MultiLineString。

  • MultiPoint: GeometryCollection中的每个几何对象都是Point类型时,它被称为MultiPoint。

2.1.2. 内容

2.1.2.1. 数据
2.1.2.1.1. 表内容 – 要素行
Requirement 18
用户数据表或视图中的每个矢量要素都应该包括值为小写“features”的列。

2.1.3. 几何对象编码

2.1.3.1. 数据
2.1.3.1.1. BLOB 格式
Requirement 19
在GeoPackage的要素表中,必须以SQL BLOB格式存储几何对象,存储时使用标准的GeoPackageBinary格式进行编码,存储的几何对象可以带有或没有可选的海拔(Z)值和/或测量(M)值,其中GeoPackageBinary格式可参见表GeoPackage SQL Geometry Binary FormatBLOB 格式章节的定义。
GeoPackage SQL Geometry Binary Format
GeoPackageBinaryHeader {
  byte[2] magic = 0x4750; (1)
  byte version;           (2)
  byte flags;             (3)
  int32 srs_id;
  double[] envelope;      (4)
}

StandardGeoPackageBinary {
  GeoPackageBinaryHeader header; (5)
  WKBGeometry geometry;          (6)
}
1 GP in ASCII
2 8-bit无符号整数, 0 = version 1
3 参见 bit layout of GeoPackageBinary flags byte
4 参见下面的最小外接矩阵标识码说明
5 The X bit in the header flags field must be set to 0.
6 参见 ISO 13249-3 [12] 的 5.1.46 章节 [6][7][8]
Table 5. bit layout of GeoPackageBinary flags byte

bit

7

6

5

4

3

2

1

0

use

R

R

X

Y

E

E

E

B

flag bits use:

  • R: 保留位,供将来使用;设置为0

  • X: GeoPackageBinary 类型

  • Y: 几何对象是否为空的标识

    • 0: 非空几何对象

    • 1: 空的几何对象

  • E: 最小外接矩形的标识码 (3-bit无符号整数)

    • 0: 没有外接矩形 (space saving slower indexing option), 0 bytes

    • 1: 外接矩形用[minx, maxx, miny, maxy]表示, 32 bytes

    • 2: 外接矩形用[minx, maxx, miny, maxy, minz, maxz]表示, 48 bytes

    • 3: 外接矩形用[minx, maxx, miny, maxy, minm, maxm]表示, 48 bytes

    • 4: 外接矩形用[minx, maxx, miny, maxy, minz, maxz, minm, maxm]表示, 64 bytes

    • 5-7: 非法

  • B: header值的字节顺序(1-bit Boolean)

    • 0: 高字节序 (高位字节排放在前面)

    • 1: 低字节序 (低位字节排放在前面)

ISO 13249-3 [12]中定义的WKB(well-known binary)并没有为空的点集提供标准编码(例如,WKT(Well-known text)中的空点)。在GeoPackage中,这些点应该被表示为IEEE-754标准的沉寂NaN(quite NaN)值,GeoPackage应使用高字节序0x7ff8000000000000或低字节序0x000000000000f87f来为NaN值进行二进制编码。

当GeoPackage中的WKBGeometry的二进制值为空时,要么最小外接矩形的内容标识符为0,代表没有最小外接矩形,要么最小外接矩形的值为NaN,表示空点。

2.1.4. SQL几何类型

2.1.4.1. 数据
2.1.4.1.1. 核心类型
Requirement 20
GeoPackage要素表中存储的几何对象,类型应该是表几何对象类型 (规范性的)Geometry Type Codes (Core)中基本类型(Geometry, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeomCollection),应该使用GeoPackageBinary几何编码格式进行二进制编码。

2.1.5. 几何要素列

2.1.5.1. 数据
2.1.5.1.1. 表定义
Requirement 21
在GeoPackage中,如果表gpkg_contentsdata_type列有“feature”值,那么也应该存在一个名为gpkg_geometry_columns的表或可更新视图,有关gpkg_geometry_columns表的说明参见 Geometry Columns Table or View Definitiongpkg_geometry_columns Table Definition SQL

gpkg_geometry_columns是对应GeoPackage矢量要素的SQL schema的第二个部分(component),该表用于标识存储要素数据的表中,哪一列存储的是几何对象。

Table 6. Geometry Columns Table or View Definition
Column Name Type Description Key

table_name

TEXT

包含几何对象的表名

PK, FK

column_name

TEXT

表中存储几何对象的列名

PK

geometry_type_name

TEXT

取值参见附录几何对象类型 (规范性的)中的表 Geometry Type Codes (Core) 或表 Geometry Type Codes (Extension)

srs_id

INTEGER

空间参考系统 ID: gpkg_spatial_ref_sys.srs_id

FK

z

TINYINT

0:禁止z值; 1:z值必须有; 2:z值可选

m

TINYINT

0:禁止m值; 1:m值必须有; 2:m值可选

gpkg_geometry_columns中的srs_id作为外键(FK)与表gpkg_spatial_ref_sys的主键srs_id关联,确保了要素表中的几何对象都属于指定的坐标系。

上述表(或视图)的视图(Views)可以使SQL/MM[12] SQL/MM View of gpkg_geometry_columns Definition SQL (Informative)标准兼容OGC Simple Features SQL [9][10][11] SF/SQL VIEW of gpkg_geometry_columns Definition SQL (Informative)标准。

2.1.5.1.2. 表数据值
Requirement 22
在GeoPackage中,针对每个矢量要素表(矢量要素数据表节),gpkg_geometry_columns表(或可更新视图)都应该包含一行记录来标识该矢量要素表的哪一列存储的是几何对象。
Requirement 23
gpkg_geometry_columnstable_name 列的值必须与表gpkg_contentstable_name列值为features的记录的table_name值一一对应。
Requirement 24
gpkg_geometry_columns中某条记录的column_name列值,必须是该条记录中table_name列所对应的表或视图中的一个列名。
Requirement 25
gpkg_geometry_columnsgeometry_type_name列的值必须是附录 几何对象类型 (规范性的) 中大写的几何类型名字之一。
Requirement 26
gpkg_geometry_columnssrs_id列的值必须能在表gpkg_spatial_ref_syssrs_id列中找到。
Requirement 27
gpkg_geometry_columns中的z值必须是0, 1或2。
Requirement 28
gpkg_geometry_columns中的m值必须是0, 1或2。

2.1.6. 矢量要素数据表

2.1.6.1. 数据
2.1.6.1.1. 表定义

在GeoPackage文件中,上面的简单要素的SQL介绍章节描述的是SQL schema中描述矢量要素的第三个部分。 包括几何对象在内的要素属性,在要素表中对应的是列。 要素记录在要素表中对应的是行。[9]

Requirement 29
GeoPackage可以有包含有矢量要素的表或可更新的视图。 在GeoPackage中,每个这样的要素表或视图都必须有一个INTEGER类型的列,该列的约束必须是PRIMARY KEY AUTOINCREMENT, 参见 EXAMPLE : 样本要素表/视图的定义sample_feature_table Table Definition SQL (Informative)

通过表gpkg_metadata_reference(参见元数据参考表)中的rowid [B5] 值,要素表的integer主键可以将要素与表gpkg_metadata中的元数据记录关联起来。

Requirement 30
要素表有且仅有一个几何要素列。

非GeoPackage标准的要素数据模型中,每个要素表中可能包含多个几何对象列,这种要素表可以按几何对象类型转换为多个独立的符合GeoPackage标准的要素表,这些独立的要素表可通过interger类型的主键值构成一个整体视图,这个整体视图与原有的非GeoPackage标准的要素数据模型拥有同样的列定义。

Table 7. EXAMPLE : 样本要素表/视图的定义
Column Name Type Description Null Default Key

id

INTEGER

自动增量主键

no

PK

geometry

GEOMETRY

GeoPackage Geometry 符合GeoPackage规范的几何要素

yes

text_attribute

TEXT

要素的文本属性

yes

real_attribute

REAL

要素的Real属性

yes

boolean_attribute

BOOLEAN

要素的布尔属性

yes

raster_or_photo

BLOB

区域图片

yes

2.1.6.1.2. 表数据值

几何要素存储在几何对象列中,几何对象列由表gpkg_geometry_columns中的geometry_column列值指定,列值为geometry_column列值的小写形式。表gpkg_geometry_columns的定义参见几何要素列

由表gpkg_geometry_columnsgeometry_type_name标识的几何要素类型必须是 几何对象类型 (规范性的)中的一个 。

Requirement 31
要素表中的几何对象类型由表gpkg_geometry_columnsgeometry_type_name列确定,为该列值的大写形式,要素表的几何对象列应该存储该类型的几何对象[10]

几何对象类型 (规范性的)中的几何对象都是可继承的,在核心几何模型中展示了部分继承关系。 例如:如果表gpkg_geometry_columns中列geometry_type_name表示的几何类型没有子类型,如POINT,那么对应的要素表中的几何对象可能只有该类型一种。 如果表gpkg_geometry_columns中列geometry_type_name表示的几何类型有子类型,如GEOMCOLLECTION,那么对应的要素表中的几何对象,可能只有该类型一种,也可能是该类型的直接或间接子类型等多种。 如果geometry_type_name是GEOMETRY (几何类型继承关系的根),那么对应的要素表中的几何对象,可能是任意几何类型。

几何要素包不包含可选的高程(Z)和/或测量(M)值,不会改变它的类型或类型的继承关系。

几何对象列的空间参考系类型是由表gpkg_geometry_columns中的srs_id标识的,值为表gpkg_spatial_ref_syssrs_id列的其中一个值。

Requirement 32
要素表中几何对象的空间参考系,必须与表gpkg_geometry_columnssrs_id值保持一致。

2.2. 瓦片

2.2.1. 瓦片矩阵介绍

有关存储、索引、访问和描述金子塔中瓦片的商业和开源规则多种多样,然而,很不幸,在这个领域并没有形成标准的约定、国家标准或国际标准。 此外,不同的影像文件格式有不同的表述特性,也各自包含不同的自描述元数据。

瓦片数据/元数据存储模型和约定从两个方面直接支撑GeoPackage文件中瓦片的使用。首先,现有应用中的数据表可能遵循的是其他接口约定,它们描述了如何在这些数据表的最顶层创建数据/元数据模型的SQL视图;其次,它们在数据集和记录的级别包含和暴露了大量元数据信息,从而允许应用程序在不解析所有影像的情况下,利用GeoPackage数据挖掘数据细节。

GeoPackage瓦片存储模型可以直接通过SQLite数据库中的SQL表实现,这种方法性能最高;也可以通过在已有SQLite瓦片存储中的数据表顶层,通过SQL视图实现,这种方法具有高适应性和低耦合的特征,更有利于标准的传播。

同一个容器中,GeoPackage可以在不同的数据表或视图中存储多个栅格和瓦片金字塔数据集。 [11] “Tile pyramid(瓦片金字塔)”的概念中,不同缩放级别下的瓦片表示不同空间范围、具备不同分辨率,“Tile pyramid(瓦片金字塔)”也指瓦片数据本身。 “Tile matrix(瓦片矩阵)” 指的是某一缩放级别下,瓦片组成的行和列。该缩放级别中的这些瓦片表示相同的空间范围,具有相同的分辨率 。 “Tile matrix set(瓦片矩阵集合)”指的是瓦片金字塔层次结构的定义。

实现瓦片数据/元数据存储模型的表或视图,会在接下来的子章节中分别阐述和探讨。

2.2.2. 内容

2.2.2.1. 数据
2.2.2.1.1. 内容表 – 瓦片列
Requirement 33
gpkg_contents 表必须对于每个瓦片金字塔用户数据表或视图 都对应包含一条记录, 这条记录中要包含 名为data_type 列,且列值为 “tiles”.

2.2.3. 缩放级别

在GeoPackage中,瓦片矩阵集中有不同级别的瓦片矩阵图层,缩放级别是指与瓦片矩阵图层相对应的从0到n的有序整形数字,用于标识不同的瓦片矩阵图层。随着缩放级别的递增,每个瓦片所代表的实际空间范围会变小,空间分辨率却会越高,图像也会更加清晰。 相邻缩放级别间递增或递减,值相差1。像素大小是一个真实数字,单位为瓦片图像空间参考系的地形单位,这个数字规定了一个像素所代表的现实世界区域大小。 在瓦片矩阵集的相邻的缩放级别间,像素大小可以按照固定倍率、不同倍率或间隔变化 在常用的“两倍缩放(zoom times two)”惯例中,所有相邻缩放级别的像素大小相差2倍,如下面瓦片两倍缩放示例 (资料性的) 中所展示的那样。 而在“其他缩放间隔(zoom other intervals)”惯例中,为了栅格数据直观的图像显示、以及与常用的全球影像产品中的原始像素大小保持一致,像素大小会按照不同倍率或不规则的间隔进行变化。 参见 WMTS [16] Annex E,这是两种惯例的附加示例。

2.2.3.1. 数据
2.2.3.1.1. 两倍缩放
Requirement 34
在一个有瓦片金字塔的GeoPackage中,默认情况下[12],瓦片矩阵表中相邻缩放级别的像素大小相差2倍。

2.2.4. PNG瓦片编码格式

2.2.4.1. 数据
2.2.4.1.1. PNG MIME类型
Requirement 35
在GeoPackage中,瓦片金字塔数据表中的瓦片数据如果不是 MIME type image/jpeg [17][18][19]类型,那么默认就是 MIME type image/png [20][21]类型。[13]

2.2.5. JPEG瓦片编码格式

2.2.5.1. 数据
2.2.5.1.1. JPEG MIME类型
Requirement 36
在GeoPackage中,瓦片金字塔数据表中的瓦片数据如果不是 MIME type image/png [20][21]类型,那么默认就是 MIME type image/jpeg [17][18][19]类型。[14]

2.2.6. 瓦片矩阵集

2.2.6.1. 数据
2.2.6.1.1. 表定义
Requirement 37
包含瓦片金字塔数据表的Geopackage文件,必须有一个gpkg_tile_matrix_set表或视图,gpkg_tile_matrix_set表或视图需要符合表定义章节、表瓦片矩阵集合的表或视图定义 和表gpkg_tile_matrix_set Table Creation SQL的规定。
Table 8. 瓦片矩阵集合的表或视图定义
Column Name Column Type Column Description Null Default Key

table_name

TEXT

瓦片金字塔数据表名

no

PK, FK

srs_id

INTEGER

空间参考系ID: gpkg_spatial_ref_sys.srs_id

no

FK

min_x

DOUBLE

table_name表中所有数据的边界框的最小 x 值

no

min_y

DOUBLE

table_name表中所有数据的边界框的最小 y 值

no

max_x

DOUBLE

table_name表中所有数据的边界框的最大 x 值

no

max_y

DOUBLE

table_name表中所有数据的边界框的最大 y 值

no

表gpkg_tile_matrix_set(或可更新视图)为瓦片金字塔数据表中的所有瓦片定义了最小的边界框(min_x, min_y, max_x, max_y),以及空间参考系(srs_id)。

2.2.6.1.2. 表数据值

瓦片金字塔数据表对应的表gpkg_tile_matrix_set(或可更新视图)定义的最小边界框必须是精确的。这样以来,根据表 gpkg_tile_matrix table 或视图中的数据表中的瓦片行列号,瓦片金字塔中独立瓦片的边界框坐标可以计算出来。 例如,因为Geopackage遵循左上角瓦片作为坐标原点的约定(参见表数据的取值),所以,在表gpkg_tile_matrix_set的table_name列对应的瓦片金字塔数据表中,无论哪个缩放级别,(min_x, max_y)位置一定是的瓦片(0,0)的左上角坐标。

Requirement 38
gpkg_tile_matrix_settable_name列的值必须与表gpkg_contents中数据类型为"tiles"的记录的table_name列值一一对应。
Requirement 39
针对每个瓦片金字塔数据表,gpkg_tile_matrix_set表或视图都必须包含一条记录。
Requirement 40
gpkg_tile_matrix_setsrs_id 列的值必须与gpkg_spatial_ref_syssrs_id列值一一对应。

2.2.7. 瓦片矩阵

2.2.7.1. 数据
2.2.7.1.1. 表的定义
Requirement 41
包含瓦片金字塔数据表的GeoPackage,应包含一个gpkg_tile_matrix表或视图,gpkg_tile_matrix表或视图要符合2.2.7.1.1 表的定义、表瓦片矩阵元数据表或视图的定义以及表 gpkg_tile_matrix Table Creation SQL的规定。
Table 9. 瓦片矩阵元数据表或视图的定义
Column Name Column Type Column Description Null Key

table_name

TEXT

瓦片金字塔用户数据表的表名

no

PK, FK

zoom_level

INTEGER

0 ⇐ zoom_level ⇐ max_level for table_name

no

PK

matrix_width

INTEGER

在当前缩放级别下,瓦片矩阵的列数。(>=1)

1

matrix_height

INTEGER

在当前缩放级别下,瓦片矩阵的行数。(>=1)

1

tile_width

INTEGER

在当前缩放级别下,瓦片的宽度(以像素为单位)。(>=1)

no

tile_height

INTEGER

在当前缩放级别下,瓦片的高度(以像素为单位。(>=1)

no

pixel_x_size

DOUBLE

以t_table_name 的srid单位表示,默认单位是米(srid为0时)。(>=0)

no

pixel_y_size

DOUBLE

以t_table_name 的srid单位表示,默认单位是米(srid为0时)。(>=0)

no

gpkg_tile_matrix表或可更新的视图记录了每个tiles表中每个缩放级别下的tile matrix的结构。GeoPackage不仅允许包含正方形的瓦片,也允许包含长方形的瓦片(例如,为了更好的表达两极地区)。瓦片金字塔允许有这样的缩放级别:相邻级别分辨率相差2倍、相邻级别分辨率变化不规律、或者相邻级别分辨率变化虽然规律,但不是相差2倍。

2.2.7.1.2. 表数据的取值
Requirement 42
gpkg_tile_matrix表中的 table_name 列的值,应该与gpkg_contents表中,data_type值为“tiles”的行的table_name值一一对应。
Requirement 43
gpkg_tile_matrix表或视图应该针对每一个缩放级别包含一行记录,该行记录对应的瓦片金字塔数据或视图应该包含一个或多个瓦片。

在瓦片金字塔数据表中,缩放级别中没有瓦片时,gpkg_tile_matrix表或视图中也可以有对应的记录行。

GeoPackages 遵循最常用的惯例,如 WMTS [16]所指定,瓦片的原点在左上,缩放到“whole world”级别 下对应的比例尺是最小比例尺,对应的缩放级别为 0 级 [15]。 瓦片坐标(0,0)通常指在任何缩放级别下 tile matrix的左上角,该左上角的瓦片可以不是实际存在的。

Requirement 44
gpkg_tile_matrix表中zoom_level这一列的值不能为负值
Requirement 45
gpkg_tile_matrix表中matrix_width这一列的值必须大于0
Requirement 46
gpkg_tile_matrix表中matrix_height这一列的值必须大于0
Requirement 47
gpkg_tile_matrix表中tile_width 这一列的值必须大于0
Requirement 48
gpkg_tile_matrix表中tile_height 这一列的值必须大于0
Requirement 49
gpkg_tile_matrix表中pixel_x_size这一列的值必须大于0
Requirement 50
gpkg_tile_matrix表中pixel_ y _size这一列的值必须大于0
Requirement 51
gpkg_tile_matrix表中,当zoom_level列升序排列时,pixel_x_sizepixel_y_size列的值应该为降序排列。

0级别或者其它缩放级别可能有瓦片,也可能没有瓦片。 [16] 这意味着tile matrix set 可以是稀疏的,例如,在一个确定的缩放级别 下,并不是所有位置都包含瓦片。 [17]这并不影响gpkg_contents表中该缩放级别对应记录的空间范围(由min_x、min_y、max_x、max_y列的值确定),也不影响gpkg_tile_matrix_set表中该缩放级别对应记录的精确空间范围(由min_x、min_y、max_x、max_y列的值确定),更不会影响该缩放级别的瓦片矩阵宽和高。 [18]

2.2.8. 瓦片金字塔数据表

2.2.8.1. 数据
2.2.8.1.1. 表定义
Requirement 52
GeoPackage中的每个瓦片矩阵集(tile matrix set)必须存储在独立的瓦片金字塔数据表或可更新的视图(view)中。这些数据表或视图必须具备唯一的名称,必须包含类型为INTGER的名为“id”的列,该列必须有PRIMARY KEY AUTOINCREMENT列约束。参见2.2.8.1.1 表定义瓦片金字塔数据表或视图定义 以及 EXAMPLE: tiles table Insert Statement (Informative)中的规定。
Table 10. 瓦片金字塔数据表或视图定义
Column Name Column Type Column Description Null Default Key

id

INTEGER

自动增长的主键(primary key)

no

PK

zoom_level

INTEGER

min(zoom_level) ⇐ zoom_level ⇐ max(zoom_level) for t_table_name

no

0

UK

tile_column

INTEGER

大于0,小于gpkg_tile_matrix表的matrix_width值

no

0

UK

tile_row

INTEGER

大于0,小于gpkg_tile_matrix表的matrix_height值

no

0

UK

tile_data

BLOB

条款PNG瓦片编码格式, JPEG瓦片编码格式, WEBP瓦片编码格式, [tile_enc_tiff], [tile_enc_nitf]中定义的影像 MIME 类型。

no

2.2.8.1.2. 表数据取值

每个瓦片金字塔用户数据表或视图 [19]都可以包含多个瓦片矩阵,这些瓦片矩阵对应第0级或更多缩放级别,每个缩放级别对应不同的空间分辨率(地图比例尺)。

Requirement 53
在GeoPackage文件中,gpkg_tile_matrix(tm)表中的每个不同的table_name所对应的瓦片金字塔(tp)数据表中, zoom_level列的值应该符合以下条件:min(tm.zoom_level) ⇐ tp.zoom_level ⇐ max(tm.zoom_level)
Requirement 54
在GeoPackage文件中,gpkg_tile_matrix (tm)表中的每个不同的table_name所对应的瓦片金字塔(tp)数据表中, tile_column列的值应该符合以下条件:当tm和tp的zoom_level 列值相同时,0 ⇐ tp.tile_column ⇐ tm.matrix_width – 1。
Requirement 55
在GeoPackage文件中,gpkg_tile_matrix (tm)表中的每个不同的table_name所对应的瓦片金字塔(tp)数据表中, tile_row列的值应该符合以下条件:当tm和tp的zoom_level 列值相同时,0 ⇐ tp.tile_row ⇐ tm.matrix_height – 1。

瓦片表中,同一缩放级别的所有瓦片都具有相同的pixel_x_sizepixel_y_size值,该值是在gpkg_tile_matrix表中指定的。[20]

2.3. Schema

2.3.1. Schema 介绍

schema选项提供了一种描述GeoPackage表列的方法,它可以比SQL表定义得到更多的细节。通过schema选项可以更加友好的呈现现有GeoPackage数据,也可以实现数据有效性验证。

2.3.2. 数据列

2.3.2.1. 数据
2.3.2.1.1. 表定义
Requirement 56
GeoPackage 中可以包含一个名为gpkg_data_columns的表或可更新视图。表或视图的定义需要符合表定义章节、表Data Columns Table or View Definition 和表gpkg_data_columns Table Definition SQL的规定。
Table 11. Data Columns Table or View Definition
Column Name Column Type Column Description Null Key

table_name

TEXT

视图或要素表名

no

PK

column_name

TEXT

列名

no

PK

name

TEXT

column_name列目录可读标识符(e.g. 短名称)

yes

title

TEXT

column_name列目录可读正式标题

yes

description

TEXT

table_name列内容可读描述

yes

mime_type

TEXT

如果为BLOB类型,则column_name为http://www.iana.org/assignments/media-types/index.html[MIME] [21] 类型,如果为NULL,则为其它类型

yes

constraint_name

TEXT

要区分大小写的约束名,与gpkg_data_column_constraints表中的约束名一一对应

yes

GeoPackage应用程序可以[21]使用表gpkg_data_columns存储精简的应用程序schema标识、描述、和http://www.iana.org/assignments/media-types/index.html[MIME] [21] 类型[22]信息,这些信息与矢量要素数据表和瓦片矩阵数据表的列相关,有了这些信息,通过SQLite的sqlite_master表、以及table_info(table_name) SQL指令,就可以获取附加数据。 gpkg_data_columns数据可以提供更具体的列数据类型、取值范围、特定应用结构和语义信息,这些内容使用户界面展示的信息更丰富,使用户更有效地判断GeoPackage内容是否适合特定用途。

2.3.2.1.2. 表数据值
Requirement 57
gpkg_data_columnstable_name列的值应该与gpkg_contentstable_name 列的值一一对应。
Requirement 58
gpkg_data_columns表记录中的table_name列值标识了一个SQLite表或视图,同一记录中的column_name列值应该为该SQLite表或视图中的一个列名。
Requirement 59
gpkg_data_columnsconstraint_name列值可能为 NULL,如果不为NULL,则该列值应该取自表gpkg_data_column_constraints的constraint_name列,且区分大小写。

2.3.3. 数据列约束

2.3.3.1. 数据
2.3.3.1.1. 表定义
Requirement 60
GeoPackage中可能包含名为 “gpkg_data_column_constraints” 的表或可更新视图。如果有,它应该符合章节2.3.3.1.1 表定义, Data Column Constraints Table or View Definitiongpkg_data_columns Table Definition SQL的规定。

gpkg_data_column_constraints表中的数据可以为值为基本数据类型的列指定约束限制。constraint_name列与章节Data Columns Table or View Definition中定义的gpkg_data_columns 表的constraint_name列一一对应。

Table 12. Data Column Constraints Table or View Definition
Column Name Column Type Column Description Null Key

constraint_name

TEXT

区分大小写的约束名

no

Unique

constraint_type

TEXT

约束类型,取值的小写形式为rangeenumglob

no

Unique

value

TEXT

类型为enumglob的值,区分大小写,当constraint_typerange时,取值为NULL

yes

Unique

min

NUMERIC

‘range’(值域)的下限值,当constraint_type为‘enum’ 或‘glob’ 时,值为NULL

yes

minIsInclusive

BOOLEAN

如果min值不在‘range’(值域)范围内,minIsInclusive的值则为0(false),反之则为1(true)

yes

max

NUMERIC

‘range’(值域)的上限值,当constraint_type为‘enum’ 或‘glob’ 时,值为NULL

yes

maxIsInclusive

BOOLEAN

如果max值不在‘range’(值域)范围内,maxIsInclusive的值则为0(false),反之则为1(true)

yes

description

TEXT

对于ranges或globs,描述约束; 对于enums(枚举), 则描述enum值

yes

min和max列被定义为NUMERIC类型,是为了能够表示数值数据列(数据类型由表1定义)的值域。这是 Req 5中阐明的数据类型规则的唯一一次例外。

2.3.3.1.2. 表数据值

gpkg_data_column_constraints表中constraint_type列的值指定了约束的类型,值的小写形式为:"range", "enum", 或"glob" (文本模式匹配)。 value列的值区分大小写,当constraint_type列值为"enum"时,value列的值为合法的枚举值;当constraint_type列值为"glob"时,value列的值为模式匹配字符串;当constraint_type列值为"range"时,value列的值为NULL。 在constraint_name值相同,且constraint_type值为"enum"的所有记录中,value列值的集合包含了constraint_name约束的所有可能的枚举值。 constraint_type列值为"range"的记录中,min和max列的值分别指定了值域的有效最大值和最小值,constraint_type 列值为"enum"或"glob"的记录中,min和max列的值为NULL。 如果值域包含min和max值,则minIsInclusive 和 maxIsInclusive列值为1,反之minIsInclusive和 maxIsInclusive列值为0。如果constraint_type的值为 "enum"或 "glob",则minIsInclusive和 maxIsInclusive列值为NULL。 在应用程序更新GeoPackage数据值时,这些限制可能会被SQL触发器或代码强制执行。

Table 13. 列约束示范数据
constraint_name constraint_type value min minIsInclusive max maxIsInclusive

sampleRange

range

NULL

1

true

10

true

sampleEnum

enum

1

NULL

NULL

NULL

NULL

sampleEnum

enum

3

NULL

NULL

NULL

NULL

sampleEnum

enum

5

NULL

NULL

NULL

NULL

sampleEnum

enum

7

NULL

NULL

NULL

NULL

sampleEnum

enum

9

NULL

NULL

NULL

NULL

sampleGlob

glob

[1-2][0-9][0-9][0-9]

NULL

NULL

NULL

NULL

Requirement 61
gpkg_data_column_constraints 表可能为空。如果它包含数据,则小写的constraint_type列值只能为"range"、"enum"或"glob"之一。
Requirement 62
在gpkg_data_column_constraints表中,constraint_type列值为"range"或"glob"的记录,constraint_name值必须是唯一的。
Requirement 63
gpkg_data_column_constraints表可能为空。如果它包括constraint_type列值为"range"的记录,那这些记录的value列的值应该NULL。
Requirement 64
gpkg_data_column_constraints表可能是空的。如果它包括constraint_type列值为"range"的记录,那么这些行的min列和max列的值应该不为 NULL,且min列值小于max列值。
Requirement 65
gpkg_data_column_constraints表可能为空。如果它包括constraint_type列值为"range"的记录,那么这些行的minIsInclusive列和maxIsInclusive列的值应该为0或者1。
Requirement 66
gpkg_data_column_constraints表可能为空。如果它包括constraint_type列值为"enum"或"glob"的记录,那么这些记录的minmaxminIsInclusivemaxIsInclusive列的值应该为NULL。
Requirement 67
gpkg_data_column_constraints表可能为空。如果它包括constraint_type列值为"enum"或"glob"的记录,那这些记录的value列的值应该不是 NULL。

2.4. 元数据

2.4.1. 介绍

GeoPackage中使用两个表来存储元数据的MIME类型,以及这些MIME类型和GeoPackage中的要素、栅格和瓦片数据的关系。这两个表可以为实现ISO 19115 [28]中定义的分层元数据模型提供必要支持,参见Annex B B.5.25 MD_ScopeCode, 分层元数据的示例 (资料性的)栅格瓦片元数据的示例 (资料性的)。所以当新增或者更新GeoPackage中的数据时,可以单独修改与之相关的本地特定元数据,或者关联到已有的全局通用元数据。 gpkg_metadata表包含了元数据,在元数据表中将会进行详细的介绍。然后gpkg_metadata_reference表把gpkg_metadata表和GeoPackage中的数据关联起来,在元数据参考表中会进行详细的介绍。

GeoPackage中并不要求必须提供这样的元数据或者必须以一级以上的分层结构的形式定义元数据[23]。但是当提供了元数据时,应该使用这些表。元数据[24]以及把元数据关联到GeoPackage中内容的数据不应该保存在其它表里。

2.4.2. 元数据表

2.4.2.1. 数据
2.4.2.1.1. 表定义
Requirement 68
一个GeoPackage中可以包含一个名为gpkg_metadata的表。如果该表存在,则必须符合2.4.2.1.1 表定义, Metadata Table Definitiongpkg_metadata Table Definition SQL中的要求。

GeoPackage元数据的第一部分是gpkg_metadata表。该表存储官方定义的元数据标准的MIME[21]类型。比如ISO 19115 [28], ISO 19115-2 [B6], ISO 19139 [B7], Dublin Core [B8], CSDGM [B10], DDMS [B12], NMF/NMIS [B13]等等。在GeoPackage中,元数据是一个广义的定义,包括使用XML[B15]编码的UML模型[B14],GML规范[30],ISO 19110[B18], OWL [B20],SKOS [B21]等等。

Table 14. Metadata Table Definition
Column Name Column Type Column Description Null Default Key

id

INTEGER

元数据主键

no

PK

md_scope

TEXT

大小写敏感的作用域名称;参见元数据(Metadata)的作用域

no

‘dataset’

md_standard_uri

TEXT

定义元数据的机构的URI [23] [25]

no

mime_type

TEXT

元数据的MIME [21]类型

no

text/xml [24]

metadata

TEXT

元数据

no

’’

对于一个元数据来说,md_standard_uri字段的值是其唯一标识,该标志由定义该元数据的官方机构指定。 元数据的结构信息可以使用任意的形式表示(UML [B14], IDEF1x [B16], XML/Schema [25][26][27], RDF/S [B19]等等),这取决于定义元数据的机构。

2.4.2.1.2. 表数据值

gpkg_metadata中的md_scope列是元数据对于给定行的作用域的名字。有效的作用域名及其定义参见元数据(Metadata)的作用域。 表的初始内容来自ISO 19115 [40], 附录 B B.5.25 MD_ScopeCode编号列表。为了能在GeoPackage中使用,该列表经过了扩充[26]。增加了一个以"NA"为编号的作用域Metadata Table Definition

Table 15. 元数据(Metadata)的作用域
名称 (md_scope) Scope Code 含义

undefined

NA

元信息的作用范围未定义

fieldSession

012

适用于字段 session 的信息

collectionSession

004

适用于集合 session 的信息

series

006

适用于(数据集)序列的信息 [27]

dataset

005

适用于(几何要素)数据集的信息

featureType

010

适用于要素类型(class)的信息

feature

009

适用于要素(实例)的信息

attributeType

002

适用于属性 class 的信息

attribute

001

适用于要素(实例)特性的信息

tile

016

适用于瓦片、地理数据空间子集的信息

model

015

适用于对已有对象或假设对象进行复制或模拟的信息

catalog

NA

要素目录的元数据 [28]

schema

NA

应用程序 schema 的元数据 [29]

taxonomy

NA

分类系统或知识系统的元数据 [30]

software

013

适用于计算机软件或程序的信息

service

014

服务提供者实体通过一组定义行为的接口,例如用户案例,来供服务用户使用,service 表示作用于这种能力的信息

collectionHardware

003

适用于硬件class集合的信息

nonGeographicDataset

007

适用于非地理数据的信息

dimensionGroup

008

适用于维度群组的信息

Requirement 69
gpkg_metadata表或可更新视图中,每个md_scope列值都必须来自表元数据(Metadata)的作用域名称列。

2.4.3. 元数据参考表

2.4.3.1. 数据
2.4.3.1.1. 表定义
Requirement 70
在包含gpkg_metadata表的GeoPackage中,也应该包含一个gpkg_metadata_reference表,gpkg_metadata_reference表要符合 2.4.3.1.1 表定义, 元数据参考的定义 (表名: gpkg_metadata_reference)gpkg_metadata_reference Table Definition SQL的定义

GeoPackage元数据的第2个组件就是gpkg_metadata_reference表,它将gpkg_metadata表中的元数据与2.1.6和2.2.7章节定义的矢量要素数据、瓦片数据关联了起来。 表gpkg_metadata_reference可以没有任何记录。

Table 16. 元数据参考的定义 (表名: gpkg_metadata_reference)
Column Name Col Type Column Description Null Default Key

reference_scope

TEXT

元数据参考的作用域,取值为小写的‘geopackage’, ‘table’,‘column’, ’row’, ’row/col’之一

no

table_name

TEXT

本元数据参考针对的表名,当reference_scope的值为‘geopackage’时,取值为NULL

yes

column_name

TEXT

本元数据参考针对的列名,当reference_scope的值为‘geopackage’、 ‘table’ 或 ‘row’时,取值为NULL,当reference_scope的值为 ‘column’ 或 ‘row/col’ 时,取值为table_name对应的表中的列名。

yes

row_id_value [31]

INTEGER

reference_scope的值为‘geopackage’、‘table’ 或 ‘column’ 时,取值为NULL;当reference_scope的值为 ‘row’ 或 ‘row/col’ 时,取值为table_name表中某条记录的id值。

yes

timestamp

DATETIME

ISO 8601格式的时间戳,格式为'%Y-%m-%dT%H:%M:%fZ',可通过strftime函数获取当前时间。

no

strftime('%Y-%m-%dT%H:%M:%fZ', 'now')

md_file_id

INTEGER

gpkg_metadata_reference表针对的元数据记录,用gpkg_metadata表的id列的值标识。

no

FK

md_parent_id

INTEGER

gpkg_metadata_reference表针对的元数据记录在父gpkg_metadata表中对应的记录id,当 md_file_id 标识的就是元数据层次结构的根时,取值为NULL

yes

FK

gpkg_metadata_reference表中,当md_parent_id列的值为null时,表示该条记录就是元数据层次结构的根。[32]

2.4.3.1.2. 表数据取值
Requirement 71
gpkg_metadata_reference表中,reference_scope列的取值应该为小写的‘geopackage’, ‘table’,‘column’, ’row’, ’row/col’之一
Requirement 72
gpkg_metadata_reference表的记录中,当reference_scope列的值为‘geopackage’时,该记录的table_name列值应该为NULL。 其它记录的table_name列值应该与表gpkg_contentstable_name列的值一一对应。
Requirement 73
gpkg_metadata_reference表的记录中,当reference_scope列的值为‘geopackage’、 ‘table’ 或 ‘row’时,该记录的column_name列值应该为NULL。 其它记录的column_name列值应该为table_name列对应的SQLite表或视图中的一个列名。
Requirement 74
gpkg_metadata_reference表的记录中,当reference_scope列的值为‘geopackage’、‘table’ 或 ‘column’时,该记录的row_id_value列值应该为NULL。 其它记录的row_id_value列值应该为table_name列对应的SQLite表或视图中的某条记录的id值(ROWID)。
Requirement 75
gpkg_metadata_reference表的记录中,timestamp 列的取值应该符合ISO 8601 [29]规范,应该是一个包含UTC 小时, 分钟, 秒,以及秒的小数部分的完整的日期字符串,并应该带有‘Z’ (‘zulu’)后缀来标识时间为协调世界时(UTC)。[33]
Requirement 76
gpkg_metadata_reference表的记录中,md_file_id列的值应该来自gpkg_metadata表的id列。
Requirement 77
gpkg_metadata_reference表的记录中,当md_parent_id列的取值不为NULL时,取值应该来自gpkg_metadata表的id列,并且与同一记录中的md_file_id列的值不同。

2.5. 扩展机制

2.5.1. 介绍

GeoPackage扩展是一个或多个必要条款集合,这些条款需要按照GeoPackage 扩展的模板 (规范性的)中的GeoPackage扩展模板格式形成文档。 GeoPackage扩展可以配置/扩展GeoPackage规范中现有的必要条款,或者新增必要条款。现有必要条款的扩展示例包括:附加几何对象类型、附加几何对象SQL方法、以及附加栅格瓦片格式;新增必要条款的扩展示例包括:空间索引、触发器、附加表、BLOB列的其他编码格式、以及其他SQL方法。

GeoPackage扩展通过<author>_<extension name>形式的名称标识,其中<author> 表明了开发和维护该扩展的人或组织。 “gpkg”是<author>值的预留字符串,用于标识OGC开发和维护的GeoPackage扩展,这些扩展在GeoPackage中被使用。 在扩展的GeoPackage中使用额外扩展[34]时,实施者会使用自己的作者名来注册。

2.5.2. 扩展

2.5.2.1. 数据
2.5.2.1.1. 表定义
Requirement 78
GeoPackage可能包含一个名为gpkg_extensions的表或可更新视图,如果该表存在,那么它必须符合条款 2.5.2.1.1 表定义, GeoPackage扩展表/视图的定义 (表/视图名: gpkg_extensions)gpkg_extensions Table Definition SQL的定义。

GeoPackage扩展的应用范围可以是整个GeoPackage文件、Geopackage中的一个表或GeoPackage表中的一个列,这些扩展通过gpkg_extensions表或可更新视图来标识。 访问GeoPackage的应用程序可以直接查询gpkg_extensions表来获知它是有读/写扩展表的能力,而不需要通过查询所有数据表的内容来确定。如果应用程序没有读/写扩展表的能力,查询gpkg_extensions表时会“快速失败”,且返回一条错误信息。

Table 17. GeoPackage扩展表/视图的定义 (表/视图名: gpkg_extensions)
Column Name Col Type Column Description Null Key

table_name

TEXT

需要扩展的表的名称. 为NULL时,表示该条扩展适用于整个GeoPackage。当column_name不为NULL时,本字段也不应为NULL。

yes

Unique

column_name

TEXT

需要扩展的列的名称。为NULL时,表示该条扩展适用于整个表。

yes

Unique

extension_name

TEXT

该条扩展的名称,格式为<author>_<extension_name>,区分大小写。

no

Unique

definition

TEXT

扩展的定义,格式由GeoPackage 扩展的模板 (规范性的)或其它参考中的模板指定。

no

scope

TEXT

标识本条扩展在读/写时的作用域:read-writewrite-only,为小写形式。

no

2.5.2.1.2. Table Data Values
Requirement 79
GeoPackage的每一条扩展都应该注册在gpkg_extensions表中,有一条对应的记录。 当gpkg_extensions表或gpkg_extnsions表中的记录缺失时,表明GeoPackage文件没有扩展。
Requirement 80
gpkg_extensions table_name 列的取值应该与gpkg_contents table_name的列值一一对应,或为NULL。 当记录中的column_name列值不为NULL时,table_name的值也不应为NULL。
Requirement 81
在表gpkg_extensions的记录中,column_name的列值必须对应table_name列指定的表中的一个列,或者column_name的列值可以为NULL。
Requirement 82
在表gpkg_extensions的记录中,extension_name列的值必须是唯一的,且区分大小写,格式为<author>_<extension_name>,其中的<author>标识了开发和维护该条扩展人或组织。<author>应该由[a-zA-Z0-9]集合内的字符组成。<extension_name>应该由[a-zA-Z0-9]集合内的字符组成。 author为“gpkg”时,extension_name应该为本编码标准中定义的扩展之一,或是基于它的OGC最佳实践文档(OGC Best Practices Document)中定义的扩展之一。

关于如何按照GeoPackage 扩展的模板 (规范性的)填写GeoPackage扩展文档,附录L到附录P给出了完整的示例。 在表gpkg_extensions的记录中,标识这些扩展的definition列的值必须包含附录的名称(译者注:英文名称,例如‘GeoPackage 1.0 Specification Annex L’)

关于如何按照GeoPackage 扩展的模板 (规范性的)填写GeoPackage扩展文档,GeoPackage 几何类型扩展的模板 (规范性的)用户自定义的几何类型编码扩展的模板 (规范性的)展示的模板给出了局部示例。 使用这些模板创建的扩展定义以及其他扩展定义都必须体现在definition列中,推荐使用ASCII文本来表示,也可以使用包含定义的引用,例如URI[23]或Email地址。

Requirement 83
GeoPackage扩展需要按照GeoPackage 扩展的模板 (规范性的)中的GeoPackage扩展模板格式形成文档,在表gpkg_extensions的记录中,definition列的值必须包含或指向这个文档。

当软件通过只读方式访问GeoPackage时,一些扩展并不施加附加的必要条件。 例如,在GeoPackage SQLite 扩展中可以定义一个非标准(non-standard)的SQL方法, 一个扩展定义了一个使用该SQL方法的SQL触发器。 只有GeoPackage被写入数据时,该触发器才会被触发,所以在只读访问时,忽略这种类型的扩展是安全的。 gpkg_extensions.scope列的值“write_only”可以标识这种情况。

Requirement 84
在表gpkg_extensions的记录中,当扩展同时影响读和写操作时,scope列的值应为小写的"read-write",当扩展只影响读操作时,scope列的值应为小写的"write-only"。

作者名“gpkg”是预留字符串,用于标识OGC开发和维护的GeoPackage扩展。 作者名为“gpkg”的扩展的必要条款参见下面章节的定义。 GeoPackage实施者会使用自己的作者名来注册其他扩展。

3. 已注册的扩展

本章节规定了GeoPackage扩展的必要条款。 这些扩展是基于 GeoPackage 扩展的模板 (规范性的) 中的模板定义的,在附录J-P中可以找到它们的定义。

3.1. 要素

在包含要素章节定义的要素的GeoPackage中,可以实现如下子章节定义的扩展。

3.1.1. GeoPackage 几何类型扩展

3.1.1.1. 数据

本扩展定义了附加的几何类型,是SQL几何类型章节的扩展,在GeoPackage 几何类型扩展的模板 (规范性的)中做了部分描述。

3.1.1.1.1. 扩展类型
Requirement 85
在GeoPackage中,几何要素表中的几何类型可以是几何对象类型 (规范性的)中所列的扩展非线性的几何类型(CircularString, CompoundCurve, CurvePolygon, MultiCurve, MultiSurface, Curve, Surface)。 此时,几何对象必须使用GeoPackageBinary几何对象格式进行编码。
3.1.1.1.2. 扩展类型 - 扩展名称
Requirement 86
定义一个几何要素扩展类型时,扩展名称中的作者名应该是“gpkg”,即使用“gpkg_geom_<gname>”模板,其中<gname>是扩展几何类型,取值为GeoPackage中使用的几何对象类型 (规范性的)之一,全大写表示。
3.1.1.1.3. 扩展类型 - 扩展记录
Requirement 87
在包含 gpkg_geometry_columns 表/可更新视图的GeoPackage中,如果 gpkg_geometry_columns 表包含 geometry_type_name 列值为扩展类型的记录,那么该GeoPackage中也必须包含一个 gpkg_extensions 表,gpkg_extensions 表的部分(全部)记录的table_name 和 column_name 列值应该来自 gpkg_geometry_columns 表,用来标识扩展类型的使用范围,这些记录的extension_name列值应该涵盖 3.1.1.1.2 章节定义的几何类型。

3.1.2. 用户自定义几何类型的扩展

3.1.2.1. 数据

本扩展定义了在扩展的GeoPackage中,对用户自定义几何类型使用ExtendedGeoPackageBinary格式进行编码的规范,是对几何对象编码, SQL几何类型GeoPackage 几何类型扩展 章节的扩展,在用户自定义的几何类型编码扩展的模板 (规范性的)中做了部分描述。

3.1.2.1.1. 编码格式扩展
Requirement 88
ExtendedGeoPackageBinary格式由用户自定义的几何类型编码扩展的模板 (规范性的)定义,用于对用户自定义几何类型进行编码,该格式不能用来编码如下几何类型:在 SQL几何类型 中定义的几何类型、在 GeoPackage 几何类型扩展 中定义的几何类型、以及几何对象类型 (规范性的)中所列出的几何类型。
3.1.2.1.2. 编码格式扩展 - 扩展名称
Requirement 89
定义一个使用ExtendedGeoPackageBinary格式进行编码的几何对象扩展类型时,扩展名称按照模板“<author_name>_geom_<gname>”定义,其中的作者名(<author_name>)不能为“gpkg”,<gname>是GeoPackage中使用的扩展几何类型的名称,取值不能与几何对象类型 (规范性的)列出的相同,且必须全大写。
3.1.2.1.3. 编码格式扩展 - 扩展记录
Requirement 90
在包含 gpkg_geometry_columns 表/可更新视图的扩展GeoPackage中,如果 gpkg_geometry_columns 表包含 geometry_type_name 列值为扩展类型的记录,且这些类型不是在SQL几何类型 和 3.1.1定义的类型,也没有包含在几何对象类型 (规范性的)中,那么该扩展的GeoPackage中也必须包含一个 gpkg_extensions 表,gpkg_extensions 表的部分(全部)记录的table_name 和 column_name 列值应该来自 gpkg_geometry_columns 表,用来标识扩展类型的使用范围,这些记录的 extension_name 列值应该涵盖 3.1.1.1.2 章节定义的几何类型。
3.1.2.1.4. 几何对象列的几何类型名称
Requirement 91
gpkg_geometry_columns表的记录中,geometry_type_name表示扩展名称,它的取值必须符合Requirement 89的定义,且为全大写形式。

3.1.3. R树空间索引

3.1.3.1. 数据

本扩展增加了一种新的建立空间索引的能力,适用于根据 几何对象编码用户自定义几何类型的扩展 章节存储几何对象的列,在R树空间索引扩展 (规范性的)中做了部分描述。

3.1.3.1.1. 空间索引的实现

在针对包含海量(几千或更多)记录的要素表进行基本的空间框选搜索,返回要素子集时,空间索引能极大提高搜索性能。[35]

Requirement 92
按照3.1.3.1.1规定,GeoPackage应该使用R树空间索引扩展 (规范性的)中指定的SQLite Virtual Table RTrees和触发器,来为要素表中的几何对象列建立空间索引。
3.1.3.1.2. 空间索引 - 扩展名
Requirement 93
在gpkg_extensions表中,扩展名为“gpkg_rtree_index”的记录用来指定几何对象列的空间索引实现。
3.1.3.1.3. 空间索引 - 扩展记录
Requirement 94
在实现空间索引的GeoPackage中,应该包含一个gpkg_extensions表,且在gpkg_extensions表中,针对每一个建立空间索引的列,都应该有一条extension_name列值为“gpkg_rtree_index”的记录与之对应,该条记录的table_name值对应的表中必须包含一个建立空间索引的列,该条记录的column_name值对应的列必须是一个建立了空间索引的列。

3.1.4. 几何类型触发器

3.1.4.1. 数据

本扩展增加了一种新的几何类型触发器(geometry type triggers),适用于根据 几何对象编码用户自定义几何类型的扩展 章节存储几何对象的列,在几何类型触发器扩展 (规范性的)中做了部分描述。

3.1.4.1.1. 几何类型触发器 – 实现
Requirement 95
在GeoPackage中,为确保几何对象列对应的几何类型在gpkg_geometry_columns表中都被指定,针对每个几何对象列都应该包含SQL插入和更新的触发器,触发器由几何类型触发器扩展 (规范性的)定义。
3.1.4.1.2. 几何类型触发器 – 扩展名
Requirement 96
在gpkg_extensions表中,扩展名为“gpkg_geometry_type_trigger”的记录用来指定几何类型触发器的实现。
3.1.4.1.3. 几何类型触发器 – 扩展记录
Requirement 97
在实现了几何类型触发器的GeoPackage中,应该包含一个gpkg_extensions表,且在gpkg_extensions表中,针对每一个几何类型触发器对应的几何对象列,都应该有一条extension_name列值为“gpkg_geometry_type_trigger”的记录与之对应,该条记录的table_name值对应的要素表中必须包含一个几何对象列,该条记录的column_name值对应的列存储的必须是几何对象。

3.1.5. SRS_ID 触发器

3.1.5.1. 数据

针对根据 几何对象编码用户自定义几何类型的扩展进行编码的几何对象列,本扩展对其添加了一个新的 srs_id 触发器,该触发器由<extension_geometry_srsid_triggers>定义。

3.1.5.1.1. SRS_ID 触发器– 实现
Requirement 98
在GeoPackage 的每个几何列上应该包括在 几何对象 SRS ID 触发器扩展 (规范性的)中指定的SQL 插入和更新的触发器,用于同步gpkg_geometry_columns 表中对应列的srs_id值。
3.1.5.1.2. SRS_ID 触发器 – 扩展名
Requirement 99
在gpkg_extensions表中,扩展名为“gpkg_srs_id_trigger” 的记录用来指定SRS_ID触发器的实现。该值是在<extension_geometry_srsid_triggers>中进行指定的。
3.1.5.1.3. SRS_ID 触发器 – 扩展记录
Requirement 100
如果GeoPackage实现了要素表几何列的srs_id触发器,那么就应该包含一个gpkg_extensions 扩展表,该扩展表中针对每一个要素几何列的触发器对应的几何对象列,都应该有一条extension_name列值为“gpkg_srs_id_trigger”的记录与之对应,该条记录的table_name值对应的要素表中必须包含一个几何对象列,该条记录的column_name值对应的列存储的必须是几何对象。

3.2. 瓦片

下面子句中定义的扩展,可能在实现了每个<tiles>句子的GeoPackage 中被实现。

3.2.1. 缩放级别

3.2.1.1. 数据

其他缩放间隔扩展 (规范性的)中描述的缩放级别句子扩展,允许多级缩放。

3.2.1.1.1. 其他缩放间隔

在相邻级别缩放时,瓦片金字塔数据表中的像素大小可能按不规则的间隔变化,也可能按非2倍缩放(默认)的规则间隔变化

3.2.1.1.2. 其他缩放 – 扩展名
Requirement 101
在gpkg_extensions表中,扩展名为“gpkg_zoom_other”的记录是用来实现多级缩放。其缩放级别在<< extension_zoom_other_intervals>>金字塔用户数据表中指定。
3.2.1.1.3. 其他缩放 – 扩展记录
Requirement 102
实现多级缩放的GeoPackage应包含一个扩展表gpkg_extensions,该扩展表中针对每一个多级缩放列对应的多级缩放对象列,都应该有一条extension_name列值为"gpkg_zoom_other"的记录与之对应,该条记录的table_name值对应的要素表中必须包含一个多级缩放对象列,该条记录的column_name值对应的列存储的必须由多级缩放对象构成的瓦片金字塔用户数据。

3.2.2. WEBP瓦片编码格式

3.2.2.1. 数据

此条款扩展了PNG瓦片编码格式JPEG瓦片编码格式,允许瓦片图像以 WebP 格式进行编码,该扩展在WEBP瓦片编码格式扩展 (规范性的) 中进行了描述

3.2.2.2. WEBP MIME 类型

在包含瓦片金字塔用户数据表的GeoPackage中,tile_data存储的瓦片数据可以是image/x-web [22]MIME类型。

3.2.2.2.1. WEBP — 扩展名
Requirement 103
在gpkg_extensions表中,扩展名为"gpkg_webp" 的记录用来指定瓦片金字塔影像的存储格式为WEBP格式,WEBP格式由WEBP瓦片编码格式扩展 (规范性的)定义。
3.2.2.2.2. WEBP — 扩展记录
Requirement 104
在包含瓦片金字塔数据表的GeoPackage中,如果数据表的tile_data列存储的影像为WEBP格式,那么该GeoPackage应该包含一个 gpkg_extensions 表,针对上述的瓦片金字塔数据表,都应该能通过table_name在gpkg_extensions 表中找到对应的记录,并且这些记录的column_name列值应该为“tile_data”,extension_name列值应该为“gpkg_webp”。

4. 安全事项

在执行应用程序,部署平台、操作系统和网络环境时,利用GeoPackage进行实现需要考虑安全事项。 GeoPackage规范在应用程序、平台、 操作系统级别或网络安全上没有任何约束。

Annex A: 一致性 / 抽象测试集 (规范性的)

A.1. 基础

A.1.1. 核心

A.1.1.1. SQLite 容器
A.1.1.1.1. 数据

File Format

Test Case ID

/base/core/container/data/file_format

Test Purpose

Verify that the Geopackage is an SQLite version_3 database

Test Method

Pass if the first 16 bytes of the file contain “SQLite format 3” in ASCII.

Reference

Clause 1.1.1.1.1 Req 1:

Test Type

Basic

Test Case ID

/base/core/container/data/file_format/application_id

Test Purpose

Verify that the SQLite database header application id field indicates GeoPackage version 1.0

Test Method

Pass if the application id field of the SQLite database header contains “GP10” in ASCII.

Reference

Clause 1.1.1.1.1 Req 2:

Test Type

Basic

File Extension Name

Test Case ID

/base/core/container/data/file_extension_name

Test Purpose

Verify that the geopackage extension is ".gpkg"

Test Method

Pass if the geopackage file extension is ".gpkg"

Reference

Clause 1.1.1.1.2 Req 3:

Test Type

Basic

File Contents

Test Case ID

/base/core/container/data/file_contents

Test Purpose

Verify that the Geopackage only contains specified contents

Test Method

  1. For each gpkg_* table_name

    1. PRAGMA table_info(table_name)

    2. Continue if returns an empty result set

    3. Fail if column definitions returned by PRAGMA table_info do not match column definitions for the table in Annex C.

  2. Do test /opt/features/vector_features/data/feature_table_integer_primary_key

  3. Do test /opt/features/vector/features/data/feature_table_one_geometry_column

  4. Do test /opt/tiles/contents/data/tiles_row

  5. SELECT extension_name FROM gpkg_contents

  6. For each row from #4

    1. Fail if the substring before the first “_” is not “gpkg”

  7. Pass if no fails

Reference

Clause 1.1.1.1.3 Req 4:

Test Type

Basic

Test Case ID

/base/core/container/data/table_data_types

Test Purpose

Verify that the data types of GeoPackage columns include only the types specified by [table_column_data_types].

Test Method

  1. SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’

  2. Not testable if returns empty set

  3. For each row table name from step 1

    1. PRAGMA table_info(table_name)

    2. Fail if returns empty set

    3. For each row type column value

      1. Fail if value is not one of the data type names specified by [table_column_data_types]

  4. Pass if no fails

Reference

Test Type

Basic

Integrity Check

Test Case ID

/base/core/container/data/file_integrity

Test Purpose

Verify that the geopackage passes the SQLite integrity check.

Test Method

Pass if PRAGMA integrity_check returns “ok"

Reference

Clause [file_integrity] Req 6:

Test Type

Capability

Test Case ID

/base/core/container/data/foreign_key_integrity

Test Purpose

Verify that the geopackage passes the SQLite foreign_key_check.

Test Method

Pass if PRAGMA foreign_key_check() with no parameter value returns an empty result set

Reference

Clause [file_integrity] Req 7:

Test Type

Capability

A.1.1.1.2. API

Structured Query Language

Test Case ID

/base/core/container/api/sql

Test Purpose

Test that the GeoPackage SQLite Extension provides the SQLite SQL API interface.

Test Method

  1. sqlite3_exec(‘SELECT * FROM sqlite_master;)

  2. Fail if returns an SQL error.

  3. Pass otherwise

Reference

Clause 1.1.1.2.1 Req 8:

Test Type

Capability

Every GPKG SQLite Configuration

Test Case ID

/base/core/container/api/every_gpkg_sqlite_config

Test Purpose

Verify that a GeoPackage SQLite Extension has the Every GeoPackage SQLite Configuration compile and run time options.

Test Method

  1. For each “SQLITE_OMIT_*” <option> listed at http://www.sqlite.org/compile.html#omitfeatures

    1. SELECT sqlite_compileoption_used(SQLITE_OMIT_<option>)

    2. Fail if returns 1

  2. PRAGMA foreign_keys

  3. Fail if returns 0

  4. Pass otherwise

Reference

Clause 1.1.1.2.2 Req 9:

Test Type

Basic

A.1.1.2. 空间参考系统
A.1.1.2.1. 数据

Table Definition

Test Case ID

/base/core/gpkg_spatial_ref_sys/data/table_def

Test Purpose

Verify that the gpkg_spatial_ref_sys table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_spatial_ref_sys'

  2. Fail if returns an empty result set

  3. Pass if column names and column definitions in the returned CREATE TABLE statement in the sql column value, including data type, nullability, and primary key constraints match all of those in the contents of C.1 Table 18. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 1.1.2.1.1 Req 10:

Test Type

Basic

Table Data Values

Test Case ID

/base/core/gpkg_spatial_ref_sys/data_values_default

Test Purpose

Verify that the spatial_ref_sys table contains the required default contents.

Test Method

  1. SELECT srid, auth_name, auth_srid, srtext FROM spatial_ref_sys WHERE srid = -1 returns -1 “NONE” -1 “Undefined”, AND

  2. SELECT srid, auth_name, auth_srid, srtext FROM spatial_ref_sys WHERE srid = 0 returns 0 “NONE” 0 “Undefined”, AND

  3. SELECT definition FROM gpkg_spatial_ref_sys WHERE organization IN (“epsg”,”EPSG”) AND organization_coordsys_id 4326 returns GEOGCS ["WGS 84", DATUM ["World Geodetic System 1984", SPHEROID["WGS 84", 6378137, 298.257223563 , AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0 , AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943278, AUTHORITY["EPSG","9102"]], AUTHORITY["EPSG","4326"] (rounding the UNIT conversion factors to 16 decimal places, and ignoring any optional EBNF components <twin axes> and <to wgs84> and whitespace differences in the returned text)

  4. Pass if tests 1-3 are met

  5. Fail otherwise

Reference

Clause 1.1.2.1.2 Requirement 11:

Test Type

Capability

Test Case ID

/base/core/spatial_ref_sys/data_values_required

Test Purpose

Verify that the spatial_ref_sys table contains rows to define all srs_id values used by features and tiles in a GeoPackage.

Test Method

  1. SELECT DISTINCT gc.srs_id AS gc_srid, srs.srs_name, srs.srs_id, srs.organization, srs.organization_coordsys_id, srs.definition FROM gpkg_contents AS gc LEFT OUTER JOIN gpkg_spatial_ref_sys AS srs ON srs.srs_id = gc.srs_id

  2. Pass if no returned srs values are NULL.

  3. Fail otherwise

Reference

Clause Clause 1.1.2.1.2 Req 12:

Test Type

Capability

A.1.1.3. 内容
A.1.1.3.1. 数据

Table Definition

Test Case ID

/base/core/contents/data/table_def

Test Purpose

Verify that the gpkg_contents table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_contents'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned CREATE TABLE statement, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of C.2 Table [geometry_types_extension]. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail Otherwise

Reference

Clause 1.1.3.1.1 Req 13:

Test Type

Basic

Table Data Values

Test Case ID

/base/core/contents/data/data_values_table_name

Test Purpose

Verify that the table_name column values in the gpkg_contents table are valid.

Test Method

  1. SELECT DISTINCT gc.table_name AS gc_table, sm.tbl_name FROM gpkg_contents AS ge LEFT OUTER JOIN sqlite_master AS sm ON gc.table_name = sm.tbl_name

  2. Not testable if returns an empty result set.

  3. Fail if any gpkg_contents.table_name value is NULL

  4. Pass otherwise.

Reference

Clause 1.1.3.1.2 Req 14:

Test Type

Capability

Test Case ID

/base/core/contents/data/data_values_last_change

Test Purpose

Verify that the gpkg_contents table last_change column values are in ISO 8601 [29]format containing a complete date plus UTC hours, minutes, seconds and a decimal fraction of a second, with a ‘Z’ (‘zulu’) suffix indicating UTC.

Test Method

  1. SELECT last_change from gpkg_contents.

  2. Not testable if returns an empty result set.

  3. For each row from step 1

    1. Fail if format of returned value does not match yyyy-mm-ddThh:mm:ss.hhhZ

    2. Log pass otherwise

  4. Pass if logged pass and no fails.

Reference

Clause 1.1.3.1.2 Req 15:

Test Type

Capability

Test Case ID

/base/core/contents/data/data_values_srs_id

Test Purpose

Verify that the gpkg_contents table srs_id column values reference gpkg_spatial_ref_sys srs_id column values.

Test Method

  1. PRAGMA foreign_key_check(‘gpkg_contents’)

  2. Fail if does not return an empty result set

Reference

Clause 1.1.3.1.2 Req 16:

Test Type

Capability

A.2. 可选项

Test Case ID

/opt/valid_geopackage

Test Purpose

Verify that a GeoPackage contains a features or tiles table and gpkg_contents table row describing it.

Test Method

  1. Execute test /opt/features/contents/data/features_row

  2. Pass if test passed

  3. Execute test /opt/tiles/contents/data/tiles_row

  4. Pass if test passed

  5. Fail otherwise

Reference

Clause 2 Req 17:

Test Type

Capability

A.2.1. 要素

A.2.1.1. 简单要素的SQL介绍
A.2.1.2. 内容
A.2.1.2.1. 数据

Contents Table Feature Row

Test Case ID

/opt/features/contents/data/features_row

Test Purpose

Verify that the gpkg_contents table_name value table exists, and is apparently a feature table for every row with a data_type column value of “features”

Test Method

  1. Execute test /opt/features/vector_features/data/feature_table_integer_primary_key

Reference

Clause 2.1.2.1.1 Req 18:

Test Type

Capability

A.2.1.3. 几何对象编码
A.2.1.3.1. 数据

BLOB Format

Test Case ID

/opt/features/geometry_encoding/data/blob

Test Purpose

Verify that geometries stored in feature table geometry columns are encoded in the StandardGeoPackageBinary format.

Test Method

  1. SELECT table_name AS tn, column_name AS cn FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’)

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. SELECT cn FROM tn

    2. Not testable if none found

    3. For each cn value from step a

      1. Fail if the first two bytes of each gc are not “GP”

      2. Fail if gc.version_number is not 0

      3. Fail if gc.flags.GeopackageBinary type != 0

      4. Fail if ST_IsEmpty(cn value) = 1 and gc.flags.envelope != 0 and envelope values are not NaN

  4. Pass if no fails

Reference

Clause 2.1.3.1.1 Req 19:

Test Type

Capability

A.2.1.4. SQL几何类型
A.2.1.4.1. 数据

Core Types

Test Case ID

/opt/features/geometry_encoding/data/core_types_existing_sparse_data

Test Purpose

Verify that existing basic simple feature geometries are stored in valid GeoPackageBinary format encodings.

Test Method

  1. SELECT table_name FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. SELECT table_name AS tn, column_name AS cn FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’),

  4. Fail if returns an empty result set

  5. For each row from step 3

    1. SELECT cn FROM tn;

    2. For each row from step a, if bytes 2-5 of cn.wkb as uint32 in endianness of gc.wkb byte 1of cn from #1 are a geometry type value from Annex E Table 42, then

      1. Log cn.header values, wkb endianness and geometry type

      2. If cn.wkb is not correctly encoded per ISO 13249-3 clause 5.1.46 then log fail

      3. If cn.flags.E is 1 - 4 and some cn.wkbx is outside of cn.envelope.minx,maxx then log fail

      4. If cn.flags.E is 1 - 4 and some gc.wkby is outside of cn.envelope.miny,maxy then log fail

      5. If cn.flags.E is 2,4 and some gc.wkb.z is outside of cnenvelope.minz,maxz then log fail

      6. If cn.flags.E is 3,4 and some gc.wkb.m is outside of cn.envelope.minm,maxm then log fail

      7. If cn.flags.E is 5-7 then log fail

      8. Otherwise log pass

  6. Pass if log contanins pass and no fails

Reference

Clause 2.1.4.1.1 Req 20:

Test Type

Capability

Test Case ID

/opt/features/geometry_encoding/data/core_types_all_types_test_data

Test Purpose

Verify that all basic simple feature geometry types and options are stored in valid GeoPackageBinary format encodings.

Test Method

  1. Open GeoPackage that has feature geometry values of geometry type inAnnex E, for an assortment of srs_ids, for an assortment of coordinate values, without and with z and / or m values, in both big and little endian encodings:

  2. /opt/features/geometry_encoding/data/core_types_existing_sparse_data

  3. Pass if log contains pass record for big and little endian GP headers containing big and little endian WKBs for 0-1 envelope contents indicator codes for every geometry type value from Annex E Table 41 without and with z and/or m values.

  4. Fail otherwise

Reference

Clause 2.1.4.1.1 Req 20:

Test Type

Capability

A.2.1.5. 几何要素列
A.2.1.5.1. 数据

Table Definition

Test Case ID

/opt/features/geometry_columns/data/table_def

Test Purpose

Verify that the gpkg_geometry_columns table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_geometry_columns'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned Create TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of C.4Table 20. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.1.5.1.1 Req 21:

Test Type

Basic

Table Data Values

Test Case ID

/opt/features/geometry_columns/data/data_values_geometry_columns

Test Purpose

Verify that gpkg_geometry_columns contains one row record for each geometry column in each vector feature user data table.

Test Method

  1. SELECT table_name FROM gpkg_contents WHERE data_type = 'features'

  2. Not testable if returns an empty result set

  3. SELECT table_name FROM gpkg_contents WHERE data_type = 'features' AND table_name NOT IN (SELECT table_name FROM gpkg_geometry_columns)

  4. Fail if result set is not empty

Reference

Clause 2.1.5.1.2 Req 22:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_table_name

Test Purpose

Verify that the table_name column values in the gpkg_geometry_columns table are valid.

Test Method

  1. PRAGMA foreign_key_check(‘geometry_columns’)

  2. Fail if returns any rows with a fourth column foreign key index value of 1 (gpkg_contents)

Reference

Clause 2.1.5.1.2 Req 23:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_column_name

Test Purpose

Verify that the column_name column values in the gpkg_geometry_columns table are valid.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. PRAGMA table_info(table_name)

    2. Fail if gpkg_geometry_columns.column_name value does not equal a name column value returned by PRAGMA table_info.

  4. Pass if no fails.

Reference

Clause 2.1.5.1.2 Req 24:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_geometry_type_name

Test Purpose

Verrify that the geometry_type_name column values in the gpkg_geometry_columns table are valid.

Test Method

  1. SELECT DISTINCT geometry_type_name from gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. Fail if a returned geometry_type_name value is not in Table 42 or Table 43 in Annex E

  4. Pass if no fails.

Reference

Clause 2.1.5.1.2 Req 25:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_srs_id

Test Purpose

Verify that the gpkg_geometry_columns table srs_id column values are valid.

Test Method

  1. PRAGMA foreign_key_check(‘gpkg_geometry_columns’)

  2. Fail if returns any rows with a fourth column foreign key index value of 0

Reference

Clause 2.1.5.1.2 Req 26:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_z

Test Purpose

Verify that the gpkg_geometry_columns table z column values are valid.

Test Method

  1. SELECT z FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. SELECT z FROM gpkg_geometry_columns WHERE z NOT IN (0,1,2)

  4. Fail if does not return an empty result set

  5. Pass otherwise.

Reference

Clause 2.1.5.1.2 Req 27:

Test Type

Capability

Test Case ID

/opt/features/geometry_columns/data/data_values_m

Test Purpose

Verify that the gpkg_geometry_columns table m column values are valid.

Test Method

  1. SELECT m FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. SELECT m FROM gpkg_geometry_columns WHERE m NOT IN (0,1,2)

  4. Fail if does not return an empty result set

  5. Pass otherwise.

Reference

Clause 2.1.5.1.2 Req 28:

Test Type

Capability

A.2.1.6. 矢量要素数据表
A.2.1.6.1. 数据

Table Definition

Test Case ID

/opt/features/vector_features/data/feature_table_integer_primary_key

Test Purpose

Verify that every vector features user data table has an integer primary key.

Test Method

  1. SELECT table_name FROM gpkg_contents WERE data_type = ‘features’

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. PRAGMA table_info(table_name)

    2. Fail if returns an empty result set

    3. Fail if result set does not contain one row where the pk column value is 1 and the not null column value is 1 and the type column value is “INTEGER”

  4. Pass if no fails.

Reference

Clause 2.1.6.1.1 Req 29:

Test Type

Basic

Test Case ID

/opt/features/vector/features/data/feature_table_one_geometry_column

Test Purpose

Verify that every vector features user data table has one geometry column.

Test Method

  1. SELECT table_name FROM gpkg_contents WERE data_type = ‘features’

  2. Not testable if returns an empty result set

  3. For each row table name from step 1

    1. SELECT column_name from gpkg_geometry_columns where table_name = row table name

    2. Fail if returns more than one column name

  4. Pass if no fails

Reference

Clause 2.1.6.1.1 Req 30:

Test Type

Capability

Table Data Values

Test Case ID

/opt/features/vector_features/data/data_values_geometry_type

Test Purpose

Verify that the geometry type of feature geometries are of the type or are assignable for the geometry type specified by the gpkg_geometry columns table geometry_type_name column value.

Test Method

  1. SELECT table_name AS tn, column_name AS cn, geometry_type_name AS gt_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’)

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. SELECT DISTINCT ST_GeometryType(cn) FROM tn

    2. For each row actual_type_name from step a

      1. SELECT GPKG_IsAssignable(geometry_type_name, actual_type_name)

      2. Fail if any returned 0

  4. Pass if no fails

Reference

Clause 2.1.6.1.2 Req 31:

Test Type

Capability

Test Case ID

/opt/features/vector_features/data/data_value_geometry_srs_id

Test Purpose

Verify the the srs_id of feature geometries are the srs_id specified for the gpkg_geometry_columns table srs_id column value.

Test Method

  1. SELECT table_name AS tn, column_name AS cn, srs_id AS gc_srs_id FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents where data_type = ‘features’)

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. SELECT DISTINCT st_srid(cn) FROM tn

    2. For each row from step a

      1. Fail if returnvalue not equal to gc_srs_id

  4. Pass if no fails

Reference

Clause 2.1.6.1.2 Req 32:

Test Type

Capability

A.2.2. 瓦片

A.2.2.1. 内容
A.2.2.1.1. 数据

Contents Table – Tiles Row

Test Case ID

/opt/tiles/contents/data/tiles_row

Test Purpose

Verify that the gpkg_contents table_name value table exists and is apparently a tiles table for every row with a data_type column value of “tiles”.

Test Method

  1. SELECT table_name FROM gpkg_contents WHERE data_type = “tiles”

  2. Not testable if returns empty result set

  3. For each row from step 1

    1. PRAGMA table_info(table_name)

    2. Fail if returns an empty result set

    3. Fail if result set does not contain one row where the pk column value is 1 and the not null column value is 1 and the type column value is “INTEGER”and the name column value is “id”

    4. Fail if result set does not contain four other rows where the name column values are “zoom_level”,”tile_column”,”tile_row”, and “tile_data”.

  4. Pass if no fails.

Reference

Clause 2.2.2.1.1 Req 33:

Test Type

Capability

A.2.2.2. 缩放级别
A.2.2.2.1. 数据

Zoom Times Two

Test Case ID

/opt/tiles/zoom_levels/data/zoom_times_two

Test Purpose

Verify that by default zoom level pixel sizes for tile matrix user data tables vary by factors of 2 between adjacent zoom levels in the tile matrix metadata table.

Test Method

  1. SELECT CASE WHEN (SELECT tbl_name FROM sqlite_master WHERE tbl_name = gpkg_extensions) = gpkg_extensions THEN (SELECT table_name FROM gpkg_contents WHERE data_type = tiles AND table_name NOT IN (SELECT table_name from gpkg_extensions WHERE extension_name = gpkg_zoom_other)) ELSE (SELECT table_name FROM gpkg_contents WHERE data_type = tiles) END;

  2. Not testable if returns empty result set

  3. For each row table_name from step 1

    1. SELECT zoom_level, pixel_x_size, pixel_y_size FROM gpkg_tile_matrix WHERE table_name = selected table name ORDER BY zoom_level ASC

    2. Not testable if returns empty result set, or only one row

    3. Not testable if there are not two rows with adjacent zoom levels

    4. Fail if any pair of rows for adjacent zoom levels have pixel_x_size or pixel_y_size values that differ by other than factors of two

  4. Pass if no fails

Reference

Clause 2.2.3.1.1 Req 34:

Test Type

Capability

A.2.2.3. PNG瓦片编码格式
A.2.2.3.1. 数据

PNG MIME类型

Test Case ID

/opt/tiles/tiles_encoding/data/mime_type_png

Test Purpose

Verify that a tile matrix user data table that contains tile data that is not MIME type image/jpeg by default contains tile data in MIME type image/png.

Test Method

  1. SELECT CASE WHEN (SELECT tbl_name FROM sqlite_master WHERE tbl_name = 'gpkg_extensions') = 'gpkg_extensions' THEN (SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles' AND table_name NOT IN (SELECT table_name from gpkg_extensions WHERE extension_name IN ('gpkg_webp'))) ELSE (SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles') END;

  2. Not testable if returns empty result set

  3. For each row tbl_name from step 1

    1. SELECT tile_data FROM tbl_name

    2. For each row tile_data from step a

      1. Pass if tile data in MIME type image/png

  4. Fail if no passes

Reference

Clause 2.2.4.1.1 Req 35:

Test Type

Capability

A.2.2.4. JPEG瓦片编码格式
A.2.2.4.1. 数据

JPEG MIME类型

Test Case ID

/opt/tiles/tiles_encoding/data/mime_type_jpeg

Test Purpose

Verify that a tile matrix user data table that contains tile data that is not MIME type image/png by default contains tile data in MIME type image/jpeg.

Test Method

  1. SELECT CASE WHEN (SELECT tbl_name FROM sqlite_master WHERE tbl_name = 'gpkg_extensions') = 'gpkg_extensions' THEN (SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles' AND table_name NOT IN (SELECT table_name from gpkg_extensions WHERE extension_name IN ('gpkg_webp'))) ELSE (SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles') END;

  2. Not testable if returns empty result set

  3. For each row tbl_name from step 1

    1. SELECT tile_data FROM tbl_name

    2. For each row tile_data from step a

      1. Pass if tile data in MIME type image/jpeg

  4. Fail if no passes

Reference

Clause 2.2.5.1.1 Req 36:

Test Type

Capability

A.2.2.5. 瓦片矩阵集
A.2.2.5.1. 数据

Table Definition

Test Case ID

/opt/tiles/gpkg_tile_matrix_set/data/table_def

Test Purpose

Verify that the gpkg_tile_matrix_set table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_tile_matrix_set'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned CREATE TABLE statement in the sql column value,, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of [example_feature_table_sql]. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.2.6.1.1 Req 37:

Test Type

Capability

Table Data Values

Test Case ID

/opt/tiles/gpkg_tile_matrix_set/data/data_values_table_name

Test Purpose

Verify that values of the gpkg_tile_matrix_set table_name column reference values in the gpkg_contents table_name column for rows with a data type of “tiles”.

Test Method

  1. SELECT table_name FROM gpkg_tile_matrix_set

  2. Not testable if returns an empty result set

  3. SELECT table_name FROM gpkg_tile_matrix_set tms WHERE table_name NOT IN (SELECT table_name FROM gpkg_contents gc WHERE tms.table_name = gc.table_name AND gc.data_type != ‘tiles’)

  4. Fail if result set contains any rows

  5. Pass otherwise

Reference

Clause 2.2.6.1.2 Req 38:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix_set/data/data_values_row_record

Test Purpose

Verify that the gpkg_tile_matrix_set table contains a row record for each tile pyramid user data table .

Test Method

  1. SELECT table_name AS <user_data_tiles_table> from gpkg_contents where data_type = ‘tiles’

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. SELECT sql FROM sqlite_master WHERE type=’table’ AND tbl_name = <user_data_tiles_table>

    2. Fail if returns an empty result set

  4. Pass if no fails

Reference

Clause 2.2.6.1.2 Req 39:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix_set/data/data_values_srs_id

Test Purpose

Verify that the gpkg_tile_matrix_set table srs_id column values reference gpkg_spatial_ref_sys srs_id column values.

Test Method

  1. PRAGMA foreign_key_check(‘gpkg_geometry_columns’)

  2. Fail if returns any rows with a fourth column foreign key index value of 1 (gpkg_spatial_ref_sys)

Reference

Clause 2.2.6.1.2 Req 40:

Test Type

Capability

A.2.2.6. 瓦片矩阵
A.2.2.6.1. 数据

Table Definition

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/table_def

Test Purpose

Verify that the gpkg_tile_matrix table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_tile_matrix'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned CREATE TABLE statement in the sql column value,, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Annex C Table 23. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.2.7.1.1 Req 41:

Test Type

Basic

Table Data Values

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_table_name

Test Purpose

Verify that values of the gpkg_tile_matrix table_name column reference values in the gpkg_contents table_name column for rows with a data type of “tiles”.

Test Method

  1. SELECT table_name FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT table_name FROM gpkg_tile_matrix tmm WHERE table_name NOT IN (SELECT table_name FROM gpkg_contents gc WHERE tmm.table_name = gc.table_name AND gc.data_type != ‘tiles’)

  4. Fail if result set contains any rows

  5. Pass otherwise

Reference

Clause 2.2.7.1.2 Req 42:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_zoom_level_rows

Test Purpose

Verify that the gpkg_tile_matrix table contains a row record for each zoom level that contains one or more tiles in each tile pyramid user data table.

Test Method

  1. SELECT table_name AS <user_data_tiles_table> from gpkg_contents where data_type = ‘tiles’

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. SELECT DISTINCT gtmm.zoom_level AS gtmm_zoom, udt.zoom_level AS udtt_zoom FROM gpkg_tile_matrix AS gtmm LEFT OUTER JOIN <user_data_tiles_table> AS udtt ON udtt.zoom_level = gtmm.zoom_level AND gtmm.t_table_name = <user_data_tiles_table>

    2. Fail if any gtmm_zoom column value in the result set is NULL

  4. Pass if no fails

Reference

Clause 2.2.7.1.2 Req 43:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_zoom_level

Test Purpose

Verify that zoom level column values in the gpkg_tile_matrix table are not negative.

Test Method

  1. SELECT zoom_level FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(zoom_level) FROM gpkg_tile_matrix_metadata.

  4. Fail if less than 0.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 44:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_matrix_width

Test Purpose

Verify that the matrix_width values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT matrix_width FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(matrix_width) FROM gpkg_tile_matrix.

  4. Fail if less than 1.

  5. Pass otherwise.

Reference:

Clause 2.2.7.1.2 Req 45:

Test Type:

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_matrix_height

Test Purpose

Verify that the matrix_height values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT matrix_height FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(matrix_height) FROM gpkg_tile_matrix.

  4. Fail if less than 1.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 46:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_tile_width

Test Purpose

Verify that the tile_width values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT tile_width FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(tile_width) FROM gpkg_tile_matrix.

  4. Fail if less than 1.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 47:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_tile_height

Test Purpose

Verify that the tile_height values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT tile_height FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(tile_height) FROM gpkg_tile_matrix.

  4. Fail if less than 1.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 48:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_pixel_x_size

Test Purpose

Verify that the pixel_x_size values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT pixel_x_size FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(pixel_x_size) FROM gpkg_tile_matrix.

  4. Fail if less than 0.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 49:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_pixel_y_size

Test Purpose

Verify that the pixel_y_size values in the gpkg_tile_matrix table are valid.

Test Method

  1. SELECT pixel_y_size FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. SELECT min(pixel_y_size) FROM gpkg_tile_matrix.

  4. Fail if less than 0.

  5. Pass otherwise.

Reference

Clause 2.2.7.1.2 Req 50:

Test Type

Capability

Test Case ID

/opt/tiles/gpkg_tile_matrix/data/data_values_pixel_size_sort

Test Purpose

Verify that the pixel_x_size and pixel_y_size column values for zoom level column values in a gpkg_tile_matrix table sorted in ascending order are sorted in descending order, showing that lower zoom levels are zoomed “out”.

Test Method

  1. SELECT table_name FROM gpkg_contents WHERE data_type = ‘tiles’

  2. Not testable if returns empty result set

  3. For each row table_name from step 1

    1. SELECT zoom_level, pixel_x_size, pixel_y_size from gpkg_tile_matrix WHERE table_name = row table name ORDER BY zoom_level ASC

    2. Not testable if returns empty result set

    3. Fail if pixel_x_sizes are not sorted in descending order

    4. Fail if pixel_y_sizes are not sorted in descending order

  4. Pass if testable and no fails

Reference

Clause 2.2.7.1.2 Req 51:

Test Type

Capability

A.2.2.7. 瓦片金字塔数据表
A.2.2.7.1. 数据

Table Definition

Test Case ID

/opt/tiles/tile_pyramid/data/table_def

Test Purpose

Verify that multiple tile pyramids are stored in different tiles tables with unique names containing the required columns.

Test Method

  1. SELECT COUNT(table_name) FROM gpkg_contents WERE data_type = “tiles”

  2. Fail if less than 2

  3. SELECT table_name FROM gpkg_contents WHERE data_type = “tiles”

  4. For each row from step 3

    1. PRAGMA table_info(table_name)

    2. Fail if returns an empty result set

    3. Fail if result set does not contain one row where the pk column value is 1 and the not null column value is 1 and the type column value is “INTEGER”and the name column value is “id”

    4. Fail if result set does not contain four other rows where the name column values are “zoom_level”,”tile_column”,”tile_row”, and “tile_data”.

  5. Pass if no fails

Reference

Clause 2.2.8.1.1 Req 52:

Test Type

Basic

Table Data Values

Test Case ID

/opt/tiles/tile_pyramid/data/data_values_zoom_levels

Test Purpose

Verify that the zoom level column values in each tile pyramid user data table are within the range of zoom levels defined by rows in the gpkg_tile_matrix table.

Test Method

  1. SELECT DISTINCT table_name AS <user_data_tiles_table> FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. For each row <user_data_tiles_table> from step 1

    1. SELECT zoom_level FROM <user_data_tiles_table>

    2. If result set not empty

      1. SELECT MIN(gtmm.zoom_level) AS min_gtmm_zoom, MAX(gtmm.zoom_level) AS max_gtmm_zoom FROM gpkg_tile_matrix WHERE table_name = <user_data_tiles_table>

      2. SELECT id FROM <user_data_tiles_table> WHERE zoom_level < min_gtmm_zoom

      3. Fail if result set not empty

      4. SELECT id FROM <user_data_tiles_table> WHERE zoom_level > max_gtmm_zoom

      5. Fail if result set not empty

      6. Log pass otherwise

  4. Pass if logged pas and no fails

Reference

Clause 2.2.8.1.2 Req 53:

Test Type

Capability

Test Case ID

/opt/tiles/tile_pyramid/data/data_values_tile_column

Test Purpose

Verify that the tile_column column values for each zoom level value in each tile pyramid user data table are within the range of columns defined by rows in the gpkg_tile_matrix table.

Test Method

  1. SELECT DISTINCT table_name AS <user_data_tiles_table> FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. For each row <user_data_tiles_table> from step 1

    1. SELECT DISTINCT gtmm.zoom_level AS gtmm_zoom, gtmm.matrix_width AS gtmm_width, udt.zoom_level AS udt_zoom, udt.tile_column AS udt_column FROM gpkg_tile_matrix AS gtmm LEFT OUTER JOIN <user_data_tiles_table> AS udt ON udt.zoom_level = gtmm.zoom_level AND gtmm.t_table_name = <user_data_tiles_table> AND (udt_column < 0 OR udt_column > (gtmm_width - 1))

    2. Fail if any udt_column value in the result set is not NULL

    3. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 2.2.8.1.2 Req 54:

Test Type

Capability

Test Case ID

/opt/tiles/tile_pyramid_data/data_values_tile_row

Test Purpose

Verify that the tile_row column values for each zoom level value in each tile pyramid user data table are within the range of rows defined by rows in the gpkg_tile_matrix table.

Test Method

  1. SELECT DISTINCT table_name AS <user_data_tiles_table> FROM gpkg_tile_matrix

  2. Not testable if returns an empty result set

  3. For each row <user_data_tiles_table> from step 1

    1. SELECT DISTINCT gtmm.zoom_level AS gtmm_zoom, gtmm.matrix_height AS gtmm_height, udt.zoom_level AS udt_zoom, udt.tile_row AS udt_row FROM gpkg_tile_matrix AS gtmm LEFT OUTER JOIN <user_data_tiles_table> AS udt ON udt.zoom_level = gtmm.zoom_level AND gtmm.t_table_name = ‘<user_data_tiles_table> ' AND (udt_row < 0 OR udt_row > (gtmm_height - 1))

    2. Fail if any udt_row value in the result set is not NULL

    3. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 2.2.8.1.2 Req 55:

Test Type

Capability

A.2.3. Schema

A.2.3.1. 数据列
A.2.3.1.1. 数据

Table Definition

Test Case ID

/opt/schema/data_columns/data/data_table_def

Test Purpose

Verify that the gpkg_data_columns table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_data_columns'

  2. Fail if returns an empty result set

  3. Pass if column names and column definitions in the returned CREATE TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Annex C8 Table 30. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.3.2.1.1 Req 56:

Test Type

Basic

Data Values

Test Case ID

/opt/schema/data_columns/data/data_values_column_name

Test Purpose

Verify that for each gpkg_data_columns row, the column_name value is the name of a column in the table_name table.

Test Method

  1. SELECT table_name, column_name FROM gpkg_data_columns

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. PRAGMA table_info(table_name)

    2. Fail if gpkg_data_columns.column_name value does not equal a name column value returned by PRAGMA table_info.

  4. Pass if no fails.

Reference

Clause 2.3.2.1.2 Req 58:

Test Type

Capability

Test Case ID

/opt/schema/data_columns/data/data_values_constraint_name

Test Purpose

Verify that for each gpkg_data_columns row, the constraint_name value is either NULL or a constraint_name column value from the gpkg_data_column_constraints table.

Test Method

  1. SELECT constraint_name AS cn FROM gpkg_data_columns

  2. Not testable if returns an empty result set

  3. For each NOT NULL cn value from step 1

    1. SELECT constraint_name FROM gpkg_data_column_constraints WHERE constraint_name = cn

    2. Fail if returns an empty result set

  4. Pass if no fails

Reference

Clause 2.3.2.1.2 Req 59:

Test Type

Capability

Test Case ID

/opt/schema/data_columns/data/data_values_constraint_type

Test Purpose

Verify that for each gpkg_data_columns row, if the constraint_name value is NOT NULL then the constraint_type column value contains a constraint_type column value from the gpkg_data_column_constraints table for a row with a matching constraint_name value.

Test Method

  1. SELECT constraint_name AS cn, constraint_type AS ct FROM gpkg_data_columns

  2. Not testable if returns an empty result set

  3. For each NOT NULL cn value from step 1

    1. Fail if ct is NULL

    2. If ct NOT NULL, SELECT constraint_type FROM gpkg_data_column_constraints WHERE constraint_name = cn AND constraint_type = ct

    3. Fail if returns an empty result set

  4. Pass if no fails

Reference

Clause 2.3.2.1.2 Req 59:

Test Type

Capability

A.2.3.2. 数据列约束
A.2.3.2.1. 数据

Table Definition

Test Case ID

/opt/schema/data_column_constraints/data/table_def

Test Purpose

Verify that the gpkg_data_column_constraints table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_data_column_constraints'

  2. Fail if returns an empty result set

  3. Pass if column names and column definitions in the returned CREATE TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Annex C Table 31. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.3.3.1.1 Req 60:

Test Type

Basic

Data Values

Test Case ID

/opt/schema/data_column_constraints/data/data_values_constraint_type

Test Purpose

Verify that the gpkg_data_column_constraints constraint_type column values are one of "range", "enum", or "glob".

Test Method

  1. SELECT constraint_type AS ct FROM gpkg_data column_constraints

  2. Not testable if returns an empty result set

  3. For each ct value returned by step 1

    1. Fail if ct NOT IN ("range", "enum", "glob").

  4. Pass if no fails.

Reference

Clause 0 Req 61:

Test Type

Capability

Test Case ID

/opt/schema/data_column_constraints/data/data_values_constraint_names_unique

Test Purpose

Verify that the gpkg_data_column_constraints constraint_name column values for constraint_type values of "range", or "glob" are unique.

Test Method

  1. For each SELECT DISTINCT constraint_name AS cn FROM gpkg_data_column_constraints WHERE constraint_type IN (‘range’, ‘glob’)

    1. SELECT count(*) FROM gpkg_data column_constraints WHERE constraint_name = cn

    2. Fail if count > 1

  2. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 62:

Test Type

Capability

Test Case ID

/opt/schema/data_column_constraints/data/data_values_value_for_range

Test Purpose

Verify that the gpkg_data_column_constraints value column values are NULL for rows with a constraint_type value of "range".

Test Method

  1. SELECT constraint_type AS ct, value AS v FROM gpkg_data column_constraints WHERE constraint_type = ‘range’

  2. Not testable if returns an empty result set

  3. For each v value returned by step 1

    1. Fail if v IS NOT NULL

  4. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 63:

Test Type

Capability

Test Case ID

/opt/schema/data_column_constraints/data/data_values_min_max_for_range

Test Purpose

Verify that the gpkg_data_column_constraints min column values are NOT NULL and less than the max column values for rows with a constraint_type value of "range".

Test Method

  1. SELECT min, max FROM gpkg_data column_constraints WHERE constraint_type = ‘range’

  2. Not testable if returns an empty result set

  3. For each set of min and max values returned by step 1

    1. Fail if min IS NULL

    2. Fail if max IS NULL

    3. Fail if min >= max

  4. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 64:

Test Type

Capability

Test Case ID

/opt/schema/data_column_constraints/data/data_values_inclusive_for_range

Test Purpose

Verify that the gpkg_data_column_constraints minIsInclusive and maxIsInclusive column values are NOT NULL and either 0 or 1 for rows with a constraint_type value of "range".

Test Method

  1. SELECT minIsInclusive, maxIsInclusive FROM gpkg_data column_constraints WHERE constraint_type = ‘range’

  2. Not testable if returns an empty result set

  3. For each set of values returned by step 1

    1. Fail if minIsInclusive IS NULL

    2. Fail if maxIsInclusive IS NULL

    3. Fail if minIsInclusive is NOT IN (0,1)

    4. Fail if maxIsInclusive is NOT IN (0,1)

  4. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 65:

Test Type

Capability

Test Case ID:

/opt/schema/data_column_constraints/data/data_values_min_max_inclusive_for_enum_glob

Test Purpose:

Verify that the gpkg_data_column_constraints min, max, minIsInclusive and maxIsInclusive column values are NULL for rows with a constraint_type value of "enum" or “glob”.

Test Method:

  1. SELECT min, max, minIsInclusive, maxIsInclusive FROM gpkg_data column_constraints WHERE constraint_type IN (‘enum’,’glob)

  2. Not testable if returns an empty result set

  3. For each set of values returned by step 1

    1. Fail if min IS NOT NULL

    2. Fail if max IS NOT NULL

    3. Fail if minIsInclusive IS NOT NULL

    4. Fail if maxIsInclusive IS NOT NULL

  4. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 66:

Test Type

Capability

Test Case ID:

/opt/schema/data_column_constraints/data/data_values_value_for_enum_glob

Test Purpose:

Verify that the gpkg_data_column_constraints value column values are NOT NULL for rows with a constraint_type value of "enum" or “glob”.

Test Method:

  1. SELECT value FROM gpkg_data column_constraints WHERE constraint_type IN (‘enum’,’glob)

  2. Not testable if returns an empty result set

  3. For each value returned by step 1

    1. Fail if value IS NULL

  4. Pass if no fails.

Reference

Clause 2.3.3.1.2 Req 67:

Test Type

Capability

A.2.4. 元数据

A.2.4.1. 元数据表
A.2.4.1.1. 数据

Table Definition

Test Case ID

/opt/metadata/metadata/data/table_def

Test Purpose

Verify that the gpkg_metadata table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_metadata'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned Create TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Table 33. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.4.2.1.1 Req 68:

Test Type

Basic

Table Data Values

Test Case ID

/opt/metadata/metadata/data/data_values_md_scope

Test Purpose

Verify that each of the md_scope column values in a gpkg_metadata table is one of the name column values from Table 15 in clause 2.4.2.1.2.

Test Method

  1. SELECT md_scope FROM gpkg_metadata

  2. Not testable if returns an empty result set

  3. For each row returned from step 1

    1. Fail if md_scope value not one of the name column values from Table 15 in clause 2.4.2.1.2

  4. Pass if no fails

Reference

Clause 2.4.2.1.2 Req 69:

Test Type:

Capabilities

A.2.4.2. 元数据参考表
A.2.4.2.1. 数据

Table Definition

Test Case ID

/opt/metadata/metadata_reference/data/table_def

Test Purpose

Verify that the gpkg_metadata_reference table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_metadata_reference'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned Create TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Table 33. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.4.3.1.1 Req 70:

Test Type

Basic

Data Values

Test Case ID

/opt/metadata/metadata_reference/data/data_values_reference_scope

Test Purpose

Verify that gpkg_metadata_reference table reference_scope column values are valid.

Test Method

  1. SELECT reference_scope FROM gpkg_metadata_reference

  2. Not testable if returns an empty result set

  3. SELECT reference_scope FROM gpkg_metadata_reference WHERE reference_scope NOT IN (‘geopackage’,’table’,’column’,’row’,’row/col’)

  4. Fail if does not return an empty result set

  5. Pass otherwise.

Reference

Clause 2.4.3.1.2 Req 71:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_table_name

Test Purpose

Verify that gpkg_metadata_reference table_name column values are NULL for rows with reference_scope values of ‘geopackage’, and reference gpkg_contents table_name values for all other reference_scope values.

Test Method

  1. SELECT table_name FROM gpkg_metadata_reference

  2. Not testable if returns an empty result set

  3. SELECT table_name FROM gpkg_metadata_reference WHERE reference_scope = 'geopackage'

  4. Fail if result set contains any non-NULL values

  5. SELECT table_name FROM metadata_reference WHERE reference_scope != 'geopackage' AND table_name NOT IN (SELECT table_name FROM gpkg_contents)

  6. Fail if result set is not empty

  7. Pass otherwise.

Reference

Clause 2.4.3.1.2 Req 72:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_column_name

Test Purpose

Verify that gpkg_metadata_reference column_name column values are NULL for rows with reference scope values of ‘geopackage’, ‘table’, or ‘row’, and contain the name of a column in table_name table for other reference scope values.

Test Method

  1. SELECT column_name FROM gpkg_metadata_reference

  2. Not testable if returns an empty result set

  3. SELECT column_name FROM gpkg_metadata_reference WHERE reference_scope IN (geopackage, ‘table’, ‘row’)

  4. Fail if result set contains any non-NULL values

  5. SELECT <table_name>, <column_name> FROM metadata_reference WHERE reference_scope NOT IN (geopackage, ‘table’, ‘row’)

  6. For each row from step 5

    1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = '<table_name>'

    2. Fail if returns an empty result set.

    3. Fail if the one of the column names in the returned sql Create TABLE statement is not <column_name>

    4. Log pass otherwise

  7. Pass if logged pass and no fails.

Reference

Clause 2.4.3.1.2 Req 73:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_row_id_value

Test Purpose

Verify that gpkg_metadata_reference row_id_value column values are NULL for rows with reference scope values of ‘geopackage’, ‘table’, or ‘row’, and contain the ROWID of a row in the table_name for other reference scope values.

Test Method

  1. SELECT row_id_value FROM gpkg_metadata_reference

  2. Not testable if returns an empty result set

  3. SELECT row_id_value FROM gpkg_metadata_reference WHERE reference_scope IN (geopackage, ‘table’, ‘row’)

  4. Fail if result set contains any non-NULL values

  5. For each SELECT <table_name>, <row_id_value> FROM gpkg_metadata_reference WHERE reference_scope NOT IN (geopackage, ‘table’, ‘row’)

  6. For each row from step 5

    1. SELECT * FROM <table_name> WHERE ROWID = <row_id_value>

    2. Fail if result set is empty

    3. Log pass otherwise

  7. Pass if logged pass and no fails.

Reference

Clause 2.4.3.1.2 Req 74:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_timestamp

Test Purpose

Verify that every gpkg_metadata_reference table row timestamp column value is in ISO 8601 UTC format.

Test Method

  1. SELECT timestamp from gpkg_metadata_reference.

  2. Not testable if returns an empty result set

  3. For each row from step 1

    1. Fail if format of returned value does not match yyyy-mm-ddThh:mm:ss.hhhZ

    2. Log pass otherwise

  4. Pass if logged pass and no fails.

Reference

Clause 2.4.3.1.2 Req 75:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_md_file_id

Test Purpose

Verify that every gpkg_metadata_reference table row md_file_id column value references a gpkg_metadata id column value.

Test Method

  1. PRAGMA foreign_key_check(‘geometry_columns’)

  2. Fail if returns any rows with a fourth column foreign key index value of 0

Reference

Clause 2.4.3.1.2 Req 76:

Test Type

Capability

Test Case ID

/opt/metadata/metadata_reference/data/data_values_md_parent_id

Test Purpose

Verify that every gpkg_metadata_reference table row md_parent_id column value that is not null is an id column value from the gpkg_metadata_table that is not equal to the md_file_id column value for that row.

Test Method

  1. SELECT md_file_id FROM gpkg_metadata_reference

  2. Not testable if returns an empty result set

  3. SELECT gmr.md_file_id, gmr.md_parent_id FROM gpkg_metadata_reference AS gmr WHERE gmr.md_file_id == gmr.md_parent_id

  4. Fail if result set is not empty

  5. SELECT gmr.md_file_id, gmr.md_parent_id, gm.id FROM gpkg_metadata_reference AS gmr LEFT OUTER JOIN gpkg_metadata gm ON gmr.md_parent_id =gm.id

  6. Fail if any result set gm.id values are NULL

  7. Pass otherwise

Reference

Clause 2.4.3.1.2 Req 77:

Test Type

Capability

A.2.5. Extension Mechanism

A.2.5.1. Extensions
A.2.5.1.1. Data

Table Definition

Test Case ID

/opt/extension_mechanism/extensions/data/table_def

Test Purpose

Verify that a gpkg_extensions table exists and has the correct definition.

Test Method

  1. SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'gpkg_extensions'

  2. Fail if returns an empty result set.

  3. Pass if the column names and column definitions in the returned Create TABLE statement in the sql column value, including data type, nullability, default values and primary, foreign and unique key constraints match all of those in the contents of Table 36. Column order, check constraint and trigger definitions, and other column definitions in the returned sql are irrelevant.

  4. Fail otherwise.

Reference

Clause 2.5.2.1.1 Req 78:

Test Type

Basic

Table Data Values

Test Case ID

/opt/extension_metchanism/extensions/data/data_values_for_extensions

Test Purpose

Verify that every extension of a GeoPackage is registered in a row in the gpkg_extensions table

Test Method

  1. For each SELECT DISTINCT geometry_type_name FROM geometry_columns

    1. Fail if geometry_type_name IN Annex E Table 43 and gpkg_extensions does not contain a row where extension_name = gpkg_geom_<geometry_type_name>

    2. Fail if geometry_type_name NOT IN Annex E Table 42 or Table 43 and gpkg_extensions does not contain a row where the extension_name does not begin with “gpkg” and the extension_name ends with “geom<geometry_type_name>

  2. For each SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE ‘rtree_%’

    1. Fail if gpkg_extensions does not contain a row where extension_name = “gpkg_rtree_index”

  3. For each SELECT tbl_name FROM sqlite_master WHERE name LIKE ‘fgti_%’

    1. Fail if gpkg_extensions does not contain a row where extension_name = “gpkg_geometry_type_trigger”

  4. For each SELECT tbl_name FROM sqlite_master WHERE name LIKE ‘fgsi_%’

    1. Fail if gpkg_extensions does not contain a row where extension_name = “gpkg_srs_id_trigger”

  5. Do test / reg_ext/tiles/zoom_levels/data/zoom_other_ext_row

  6. Do test /reg_ext/tiles/tile_encoding_webp/data/webp_ext_row

  7. Do test /reg_ext/tiles/tile_encoding_webp/data/tiff_ext_row

  8. Do test /reg_ext/tiles/tile_encoding_webp/data/nitf_ext_row

  9. Pass if no fails

Reference

Clause 2.5.2.1.2 Req 79:

Test Type

Capability

Test Case ID

/opt/extension_metchanism/extensions/data/data_values_table_name

Test Purpose

Verify that the table_name column values in the gpkg_extensions table are valid.

Test Method

  1. SELECT table_name, column_name FROM gpkg_extensions

  2. Not testable if returns an empty result set

  3. For each row from step one

    1. Fail if table_name value is NULL and column_name value is not NULL.

    2. SELECT DISTINCT ge.table_name AS ge_table, sm.tbl_name FROM gpkg_extensions AS ge LEFT OUTER JOIN sqlite_master AS sm ON ge.table_name = sm.tbl_name

    3. Log pass if every row ge.table_name = sm.tbl_name (MAY both be NULL).

  4. Pass if logged pass and no fails.

Reference

Clause 2.5.2.1.2 Req 80:

Test Type

Capability

Test Case ID

/opt/extension_metchanism/extensions/data/data_values_column_name

Test Purpose

Verify that the column_name column values in the gpkg_extensions table are valid.

Test Method

  1. SELECT table_name, column_name FROM gpkg_extensions

  2. Not testable if returns an empty result set

  3. SELECT table_name, column_name FROM gpkg_extensions WHERE table_name IS NOT NULL AND column_name IS NOT NULL

  4. Pass if returns an empty result set

  5. For each row from step 3

    1. PRAGMA table_info(table_name)

    2. Fail if gpkg_extensions.column_name value does not equal a name column value returned by PRAGMA table_info.

    3. Log pass otherwise

  6. Pass if logged pass and no fails.

Reference

Clause 2.5.2.1.2 Req 81:

Test Type

Capability

Test Case ID

/opt/extension_mechanism/extensions/data/data_values_extension_name

Test Purpose

Verify that the extension_name column values in the gpkg_extensions table are valid.

Test Method

  1. SELECT extension_name FROM gpkg_extensions

  2. Not testable if returns an empty result set

  3. For each row returned from step 1

    1. Log pass if extension_name is one of those listed in Annex J or Annex L through Annex P.

    2. Separate extension_name into <author> and <extension> at the first “_”

    3. Fail if <author> is “gpkg”

    4. Fail if <author> contains characters other than [a-zA-Z0-9]

    5. Fail if <extension> contains characters other than [a-zA-Z0-9_]

    6. Log pass otherwise

  4. Pass if logged pass and no fails.

Reference

Clause 2.5.2.1.2 Req 82:

Test Type

Capability

Test Case ID

/opt/extension_mechanism/extensions/data/data_values_definition

Test Purpose

Verify that the definition column value contains or references extension documentation

Test Method

  1. SELECT definition FROM gpkg_extensions

  2. Not testable if returns an empty result set

  3. For each row returned from step 1

    1. Inspect if definition value is not like “Annex %”, or “http%” or mailto:% or “Extension Title%”

    2. Fail if definition value does not contain or reference extension documentation

  4. Pass if no fails

Reference

Clause 2.5.2.1.2 Req 83:

Test Type

Capability

Test Case ID

/opt/extension_mechanism/extensions/data/data_values_scope

Test Purpose

Verify that the scope column value is “read-write” or “write-only”

Test Method

  1. SELECT scope FROM gpkg_extensions

  2. Not testable if returns an empty result set

  3. For each row returned from step 1

    1. Fail is value is not “read-write” or “write-only”

  4. Pass if no fails

Reference

Clause 2.5.2.1.2 Req 84:

Test Type

Capability

A.3. 已注册的扩展

A.3.1. 要素

A.3.1.1. 几何对象类型
A.3.1.1.1. 数据

GeoPackage Extension Types

Test Case ID

/reg_ext/features/geometry_encoding/data/geopackage_extension_types/existing_sparse_data

Test Purpose

Verify that existing extended non-linear geometry types are stored in valid StandardGeoPackageBinary format encodings.

Test Method

  1. SELECT table_name FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. SELECT table_name AS tn, column_name AS cn FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’),

  4. Fail if returns an empty result set

  5. For each row from step 3

    1. SELECT cn FROM tn;

    2. For each row from step a, log fail if GeoPackageBinary “X” type flag is 1

    3. For each row from step a, if bytes 2-5 of cn.wkb as uint32 in endianness of gc.wkb byte 1of cn from #1 are a geometry type value from Annex E Table 43, then

    4. Log cn.header values, wkb endianness and geometry type ii. If cn.wkb is not correctly encoded per ISO 13249-3 clause 5.1.46 then log fail iii. If cn.flags.E is 1 - 4 and some cn.wkbx is outside of cn.envelope.minx,maxx then log fail iv. If cn.flags.E is 1 - 4 and some gc.wkby is outside of cn.envelope.miny,maxy then log fail

    5. If cn.flags.E is 2,4 and some gc.wkb.z is outside of cnenvelope.minz,maxz then log fail vi. If cn.flags.E is 3,4 and some gc.wkb.m is outside of cn.envelope.minm,maxm then log fail vii. If cn.flags.E is 5-7 then log fail viii. Otherwise log pass

  6. Log pass if log contains pass and no fails

Reference

Clause 3.1.1.1.1 Req 85:

Test Type

Capability

Test Case ID

/reg_ext/features/geometry_encoding/data/geopackage_extension_types/all_types_test_data

Test Purpose

Verify that all extended non-linear geometry types and options are stored in valid GeoPackageBinary format encodings.

Test Method

  1. Open GeoPackage that has feature geometry values of geometry type in Annex E, for an assortment of srs_ids, for an assortment of coordinate values, without and with z and / or m values, in both big and little endian encodings:

  2. /reg_ext/features/geometry_encoding/data/extension_types_existing_sparse_data

  3. Pass if log contains pass record for big and little endian GP headers containing big and little endian WKBs for 0-1 envelope contents indicator codes for every geometry type value from Annex E Table 43 without and with z and/or m values.

  4. Fail otherwise

Reference

Clause 3.1.1.1.1 Req 85:

Test Type

Capability

GeoPackage Geometry Types — Extensions Name

Test Case ID

/reg_ext/features/geometry_encoding/data/geopackage_extension_types/extension_name

Test Purpose

Verify that an extension name in the form gpkg_geom_<gname> is defined for each <gname> extension geometry type from Annex E Table 43 used in a GeoPackage.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row result set table_name, column_name from step 3

    1. SELECT result_set_column_name FROM result_set_table_name

    2. For each geometry column value from step a

      1. If the first two bytes of each geometry column value are “GP”, then

        1. /opt/extension_mechanism/extensions/data/table_def

        2. Fail if failed

        3. SELECT ST_GeometryType(geometry column value) AS <gtype>;

        4. SELECT extension_name FROM gpkg_extensions WERE table_name = result_set_table_name AND column_name = result_set_column_name AND extension_name = 'gpkg_geom_' || <gtype>

          1. Fail if result set is empty

          2. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.1.1.2 Req 86:

Test Type

Basic

GeoPackage Geometry Types — Extensions Row

Test Case ID

/reg_ext/features/geometry_encoding/data/geopackage_extension_types/extension_row

Test Purpose

Verify that the gpkg_extensions table contains a row with an extension_name in the form gpkg_geom_<gname> for each table_name and column_name in the gpkg_geometry_columns table with a <gname> geometry_type_name.

Test Method

/reg_ext/features/geometry_encoding/data/extension_name

Reference

Clause 3.1.1.1.3 Req 87:

Test Type

Capability

A.3.1.2. 用户自定义的几何类型
A.3.1.2.1. 数据

Extensions Encoding

Test Case ID

/reg_ext/features/geometry_encoding/data/user_defined-geometry_types/existing_sparse_data

Test Purpose

Verify that existing extended geometry types not listed in Annex E are stored in valid ExtendedGeoPackageBinary format encodings.

Test Method

  1. SELECT table_name FROM gpkg_geometry_columns

  2. Not testable if returns an empty result set

  3. SELECT table_name AS tn, column_name AS cn FROM gpkg_geometry_columns WHERE geometry_type_name NOT IN (all geometry types listed in Annex E) AND table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type = ‘features’),

  4. Fail if returns an empty result set

  5. For each row from step 3

    1. SELECT cn FROM tn;

    2. For each row from step a,

      1. log fail if GeoPackageBinary “X” type flag is 0

      2. Otherwise log pass

  6. Log pass if log contains pass and no fails

Reference

Clause 3.1.1.1.1 Req 88:

Test Type

Capability

Extensions Name

Test Case ID

/reg_ext/features/geometry_encoding/data/user_defined_geometry_types/extension_name

Test Purpose

Verify that an extension name in the form <author>_geom_<gname> is defined for each extended geometry type not listed in Annex E used in a GeoPackage.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == 'features'))

  2. Not testable if result set is empty

  3. For each row result set table_name, column_name from step 3

    1. SELECT result_set_column_name FROM result_set_table_name

    2. For each geometry column value from step a

      1. If the first two bytes of each geometry column value are “GP”, then

        1. /opt/extension_mechanism/extensions/data/table_def

        2. Fail if failed

        3. SELECT ST_GeometryType(geometry column value) AS <gtype>;

        4. SELECT extension_name FROM gpkg_extensions WERE table_name = result_set_table_name AND column_name = result_set_column_name AND extension_name NOT LIKE ‘gpkg_%’ and extension_name LIKE '%geom' || <gtype>

          1. Fail if result set is empty

          2. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.1.1.2 Req 89:

Test Type

Basic

Extensions Row

Test Case ID

/reg_ext/features/geometry_encoding/data/user_defined_geometry_types/extension_row

Test Purpose

Verify that the gpkg_extensions table contains a row with an extension_name in the form <author>_geom_<gname> for each table_name and column_name in the gpkg_geometry_columns table with a <gname> geometry_type_name.

Test Method

Do test /reg_ext/features/geometry_encoding/data/extension_encoding/extension_name

Reference

Clause 3.1.1.1.3 Req 90:

Test Type

Capability

Geometry Columns Row

Test Case ID

/reg_ext/features/geometry_encoding/data/user_defined_geometry_types/geometry_columns_row

Test Purpose

Verify that the gpkg_geometry_columns table contains a row with a geometry_type_name in the form <author>_geom_<gname> for each feature table that contains user-defined geometry types specified in the gpkg_extensions table.

Test Method

  1. SELECT extension_name FROM gpkg_extensions WHERE extension_name LIKE ‘%geom%’ AND extension_name NOT LIKE ‘gpkg_geom_%’

  2. FOR EACH extension_name from #1

    1. SELECT * FROM gpkg_geometry_columns WHERE geometry_type_name = extension_name

    2. Fail if returns an empty result set

  3. Pass if no fails.

Reference

Clause 3.1.2.1.4 Req 91:

Test Type

Capability

A.3.1.3. 空间索引
A.3.1.3.1. 数据

Spatial Indexes Implementation

Test Case ID

/reg_ext/features/spatial_indexes/implementation

Test Purpose

Verify the correct implementation of spatial indexes on feature table geometry columns.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row table_name, column_name from step 1

    1. SELECT sql FROM sqlite_master WHERE tbl_name = ‘rtree_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if result set is empty

    3. Fail if returned sql != ‘CREATE VIRTUAL TABLE rtree_’ ’ || result_set_table_name || ‘_’ || result_set_column_name || USING rtree(id, minx, maxx, miny, maxy)

    4. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tname = ‘rtree_’ || result_set_table_name || ‘_’ || result_set_column_name || ‘_insert’

    5. Fail if returned sql != result of populating insert triggers template in Annex L using result_set_table_name for <t> and result_set_column_name for <c>

    6. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND name LIKE ‘rtree_’ || result_set_table_name || ‘_’ || result_set_column_name || ‘_update%’

    7. Fail if returned sql != result of populating 4 update triggers templates in Annex L using result_set_table_name for <t> and result_set_column_name for <c>

    8. SELECT sql FROM sqlite_master WHERE type=’trigger’ AND name = ‘rtree_’ || result_set_table_name || ‘_’ || result_set_column_name || ‘_delete’

    9. Fail if returned sql != result of populating delete trigger template in Annex L using result_set_table_name for <t> and result_set_column_name for <c>

    10. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.3.1.1 Req 92:

Test Type

Capability

Test Case ID

/reg_ext/features/spatial_indexes/implementation/sql_functions

Test Purpose

Verify the correct implementation of sql functions used in spatial indexes on feature table geometry columns.

Test Method

  1. Open Geometry Test Data Set GeoPackage with GeoPackage SQLite Extension

  2. For each Geometry Test Data Set <gtype_test> data table row for each geometry type in Annex E, for an assortment of srs_ids, for an assortment of coordinate values including empty geometries, without and with z and / or m values, in both big and little endian encodings:

    1. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_IsEmpty(geom.) != empty

    2. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_MinX(geom) != minx

    3. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_MaxX(geom) != maxx

    4. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_MinY(geom) != miny

    5. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_MaxY(geom) != maxy ..

  3. Pass if no ‘Fail’ selected from step 2

Reference

Clause 3.1.3.1.1 Req 92:

Test Type

Capability

Spatial Indexes – Extensions Name

Test Case ID

/reg_ext/features/spatial_indexes/extension_name

Test Purpose

Verify that the “gpkg_rtree_index” extension name is used to register spatial index extensions.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row table_name, column_name from step 3

    1. SELECT sql FROM sqlite_master WHERE tbl_name = ‘rtree_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if returns an empty result set

    3. /opt/extension_mechanism/extensions/data/table_def

    4. Fail if failed

    5. SELECT extension_name from gpkg_extensions WHERE table_name = result_set_table_name AND column_name = result_set_column_name

    6. Log pass if result is “gpkg_rtree_index”

    7. Fail otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.3.1.2 Req 93:

Test Type

Basic

Spatial Indexes – Extensions Row

Test Case ID

/reg_ext/features/spatial_indexes/extension_row

Test Purpose

Verify that spatial index extensions are registered using the “gpkg_rtree_index” name in the gpkg_extensions table.

Test Method

/reg_ext/features/spatial_indexes/extension_name

Reference

Clause 3.1.3.1.3 Req 94:

Test Type

Capability

A.3.1.4. Geometry Type Triggers
A.3.1.4.1. Data

Geometry Type Triggers Implementation

Test Case ID

/reg_ext/features/geometry_type_triggers/implementation

Test Purpose

Verify that user feature data table geometry type triggers are implemented correctly.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if returns an empty result set

  3. For each row table_name, column_name from step 1

    1. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgti_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if returns an empty result set

    3. Fail if sql != result of populating the first trigger template in Annex M with <t> as result_set_table_name and <c> as result_set_column_name

    4. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgtu_’ || result_set_table_name || ‘_’ || result_set_column_name

    5. Fail if sql != result of populating the second trigger template in Annex M with <t> as result_set_table_name and <c> as result_set_column_name

    6. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.4.1.1 Req 95:

Test Type

Capability

Test Case ID

/reg_ext/features/geometry_type_triggers/implementation/sql_functions

Test Purpose

Verify the correct implementation of sql functions used in geometry type triggers on feature table geometry columns.

Test Method

  1. Open Geometry Test Data Set GeoPackage with GeoPackage SQLite Extension

  2. For each Geometry Test Data Set <gtype_test> data table row for each assignable (gtype, atype) and non-assignable (ntype, atype) combination of geometry type in Annex E, for an assortment of srs_ids, for an assortment of coordinate values, without and with z and / or m values, in both big and little endian encodings:

    1. SELECT ‘Fail’ FROM <gtype_test> WHERE GPKG_IsAssignable(gtype, atype) =0

    2. SELECT ‘Fail’ FROM <gtype_test> WHERE GPKG_IsAssignable(ntype, atype) = 1

    3. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_GeometryType(geom) != atype

  3. Pass if no ‘Fail’ selected from step 2

Reference

Clause 3.1.4.1.1 Req 95:

Test Type

Capability

Geometry Type Triggers – Extensions Name

Test Case ID

/reg_ext/features/geometry_type_triggers/extension_name

Test Purpose

Verify that the “gpkg_geometry_type_trigger” extension name is used to register geometry type triggers.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row table_name, column_name from step 1

    1. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgti_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if result set is empty

    3. /opt/extension_mechanism/extensions/data/table_def

    4. Fail if failed

    5. SELECT extension_name from gpkg_extensions WHERE table_name = result_set_table_name AND column_name = result_set_column_name

    6. Log pass if result is “gpkg_geometry_type_trigger”

    7. Fail otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.4.1.2 Req 96:

Test Type

Basic

Geometry Type Triggers – Extensions Row

Test Case ID

/reg_ext/features/geometry_type_triggers/extension_row

Test Purpose

Verify that geometry type triggers are registered using the “gpkg_geometry_type_trigger” extension name.

Test Method

Do test /reg_ext/features/geometry_type_triggers/extension_name

Reference

Clause 3.1.4.1.3 Req 97:

Test Type

Capability

A.3.1.5. SRS_ID 触发器
A.3.1.5.1. 数据

SRS_ID Triggers – Implementation

Test Case ID

/reg_ext/features/srs_id_triggers/implementation

Test Purpose

Verify that user feature data table srs_id triggers are implemented correctly.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row table_name, column_name from step 1

    1. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgsi_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if result set is empty

    3. Fail if sql != result of populating the first trigger template in Annex N with <t> as result_set_table_name and <c> as result_set_column_name

    4. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgsu_’ || result_set_table_name || ‘_’ || result_set_column_name

    5. Fail if sql != result of populating the second trigger template in Annex N with <t> as result_set_table_name and <c> as result_set_column_name

    6. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.1.5.1.1 Req 98:

Test Type

Capability

Test Case ID

/reg_ext/features/srs_id_triggers/implementation/sql_functions

Test Purpose

Verify the correct implementation of sql functions used in srs_id triggers on feature table geometry columns.

Test Method

  1. Open Geometry Test Data Set GeoPackage with GeoPackage SQLite Extension

  2. For each Geometry Test Data Set <gtype_test> data table row for each geometry type in Annex E, for an assortment of srs_ids, for an assortment of coordinate values, without and with z and / or m values, in both big and little endian encodings:

    1. SELECT ‘Fail’ FROM <gtype_test> WHERE ST_SRID(geom) != srs_id

  3. Pass if no ‘Fail’ selected from step 2

Reference

Clause 3.1.5.1.1 Req 98:

Test Type

Capability

SRS_ID Triggers – Extensions Name

Test Case ID

/reg_ext/features/srs_id_triggers/extension_name

Test Purpose

Verify that the “gpkg_srs_id_trigger” extension name is used to register srs_id triggers.

Test Method

  1. SELECT table_name, column_name FROM gpkg_geometry_columns WHERE table_name IN (SELECT table_name FROM gpkg_contents WHERE data_type == ‘features'))

  2. Not testable if result set is empty

  3. For each row table_name, column_name from step 1

    1. SELECT sql FROM sqlite_master WHERE type = ‘trigger’ AND tbl_name = ‘fgsi_’ || result_set_table_name || ‘_’ || result_set_column_name

    2. Not testable if result set is empty

    3. /opt/extension_mechanism/extensions/data/table_def

    4. Fail if failed

    5. SELECT extension_name from gpkg_extensions WHERE table_name = result_set_table_name AND column_name = result_set_column_name

    6. Pass if result is “gpkg_srs_id_trigger”

    7. Fail otherwise

Reference

Clause 3.1.5.1.2 Req 99:

Test Type

Basic

SRS_ID Triggers – Extensions Row

Test Case ID

/reg_ext/features/srs_id_triggers/extension_row

Test Purpose

Verify that srs_id triggers are registered using the “gpkg_srs_id_trigger” extension name.

Test Method

Do test /reg_ext/features/srs_id_triggers/extension_name

Reference

Clause 3.1.5.1.3 Req 100:

Test Type

Capability

A.3.2. 瓦片

A.3.2.1. 缩放级别
A.3.2.1.1. 数据

Zoom Other Intervals—Extensions Name

Test Case ID

/reg_ext/tiles/zoom_levels/data/zoom_other_ext_name

Test Purpose

Verify that the “gpkg_zoom_other” extension name is used to register tiles tables with other than factors of two zoom intervals.

Test Method

  1. SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles'

  2. Not testable if empty result set

  3. For each row table_name from step 1

    1. SELECT zoom_level, pixel_x_size, pixel_y_size FROM gpkg_tile_matrix WHERE table_name = selected table name ORDER BY zoom_level ASC

    2. Not testable if returns empty result set

    3. Not testable if there are not two rows with adjacent zoom levels

    4. Not testable if no pair of rows for adjacent zoom levels have pixel_x_size or pixel_y_size values that differ by other than factors of two

    5. /opt/extension_mechanism/extensions/data/table_def

    6. Fail if failed

    7. SELECT * FROM gpkg_extensions WHERE table_name = selected table name AND extension_name = 'gpkg_zoom_other'

    8. Fail if returns an empty result set

    9. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.2.1.1.1 Req 101:

Test Type

Basic

Zoom Other Intervals – Extensions Row

Test Case ID

/reg_ext/tiles/zoom_levels/data/zoom_other_ext_row

Test Purpose

Verify that tiles tables with other than factors of two zoom intervals are registered using the “gpkg_zoom_other” extension name.

Test Method

/reg_ext/tiles/zoom_levels/data/zoom_other_ext_name

Reference

Clause 3.2.1.1.2 Req 102:

Test Type:

Capability

A.3.2.2. WEBP瓦片编码格式
A.3.2.2.1. 数据

WEBP – Extensions Name

Test Case ID

/reg_ext/tiles/tile_encoding_webp/data/webp_ext_name

Test Purpose:

Verify that the “gpkg_webp” extensions name is used to register WEBP tile encoding implementations.

Test Method:

  1. SELECT table_name FROM gpkg_contents WHERE data_type = 'tiles'

  2. Not testable if empty result set

  3. For each row table_name from step 1

    1. Select tile_data FROM row table_name

    2. For each row tile_data from step a

      1. Log webp if tile data in MIME type image/webp

    3. Not testable if no logged webps

    4. /opt/extension_mechanism/extensions/data/table_def

    5. Fail if failed

    6. SELECT * FROM gpkg_extensions WHERE table_name = selected table name AND extension_name = 'gpkg_webp’

    7. Fail if returns an empty result set

    8. Log pass otherwise

  4. Pass if logged pass and no fails

Reference

Clause 3.2.2.2.1 Req 103:

Test Type

Basic

WEBP – Extensions Row

Test Case ID

/reg_ext/tiles/tile_encoding_webp/data/webp_ext_row

Test Purpose:

Verify that WEBP tile encodings are registered using the “gpkg_webp” extensions name.

Test Method:

/reg_ext/tiles/tile_encoding_webp/data/webp_ext_name

Reference:

Clause 3.2.2.2.2 Req 104:

Test Type

Capability

Annex B: 背景说明 (规范性的)

B.1. 背景

An open standard non-proprietary platform-independent GeoPackage container for distribution and direct use of all kinds of geospatial data will increase the cross-platform interoperability of geospatial applications and web services. Standard APIs for access and management of GeoPackage data will provide consistent query and update results across such applications and services. Increased interoperability and result consistency will enlarge the potential market for such applications and services, particularly in resource-constrained mobile computing environments like cell phones and tablets. GeoPackages will become the standard containers for "MyGeoData" that are used as a transfer format by users and Geospatial Web Services and a storage format on personal and enterprise devices.

This OGC® GeoPackage Encoding Standard defines a GeoPackage as a self-contained, single-file, cross-platform, serverless, transactional, open source SQLite data container with table definitions, relational integrity constraints, an SQL API exposed via a "C" CLI and JDBC, and manifest tables that together act as an exchange and direct-use format for multiple types of geospatial data including vector features, features with raster attributes and tile matrix pyramids, especially on mobile / hand held devices in disconnected or limited network connectivity environments.

Table formats, definitions of geometry types and metadata tables, relational integrity constraints, and SQL API are interdependent specification facets of the SF-SQL [9][10][11] and SQL-MM (Spatial) [12] standards that serve as normative references for the vector feature portion of this specification.

This specification attempts to support and use relevant raster types, storage table definitions, and metadata from widely adopted implementations and existing standards such as WMTS [16] and ISO metadata [28], to integrate use of rasters as attributes of geospatial features, and to define relational integrity constraints and an SQL API thereon to provide a raster analogy to the SF-SQL and SF-MM data access and data quality assurance capabilities.

Conformance classes for this specification are classified as core (mandatory) and extension (optional). The simple core of an Empty GeoPackage contains two SQL tables.

Future versions of this specification willmay include requirements for elevation data and routes. Future enhancements to this specification, a future GeoPackage Web Service specification, and modifications to existing OGC Web Service (OWS) specifications to use GeoPackages as exchange formats willmay allow OWS to support provisioning of GeoPackages throughout an enterprise or information community.

B.2. 术语和定义

This document uses the standard terms defined in Subclause 5.3 of [OGC 06-121], which is based on the ISO/IEC Directives, Part 2. Rules for the structure and drafting of International Standards. In particular, the word "shall" (not "must") is the verb form used to indicate a requirement to be strictly followed to conform to this standard.

For the purposes of this document, the following terms and definitions apply.

Empty GeoPackage

A GeoPackage that contains a gpkg_spatial_ref_sys table, a gpkg_contents table with row record(s) with data_type column values of "features" or "tiles", and corresponding features tables per clause 要素 and/or tiles tables per clause 瓦片 where the user data tables per clauses 2.1.6. and 2.2.8 exist but contain no rows.

Extended GeoPackage

A GeoPackage that contains any additional data elements (tables or columns) or SQL constructs (data types, indexes, constraints or triggers) that are not specified in this encoding standard.

geolocate

identify a real-world geographic location

GeoPackage file

a platform-independent SQLite database file that contains GeoPackage data and metadata tables with specified definitions, integrity assertions, format limitations and content constraints.

GeoPackage SQLite Configuration

consists of the SQLite 3 software library and a set of compile- and runtime configurations options.

GeoPackage SQLite Extension

a SQLite loadable extension that MAY provide SQL functions to support spatial indexes and SQL triggers linked to a SQLite library with specified configuration requirements to provide SQL API access to a GeoPackage.

georectified

raster whose pixels have been regularly spaced in a geographic (i.e., latitude / longitude) or projected map coordinate system using ground control points so that any pixel can be geolocated given its grid coordinate and the grid origin, cell spacing, and orientation.

orthorectified

georectified raster that has also been corrected to remove image perspective (camera angle tilt), camera and lens induced distortions, and terrain induced distortions using camera calibration parameters and DEM elevation data to accurately align with real world coordinates, have constant scale, and support direct measurement of distances, angles, and areas.

Valid GeoPackage

A GeoPackage that contains features per clause 要素 and/or tiles per clause 瓦片 and row(s) in the gpkg_contents table with data_type column values of "features" and/or "tiles" describing the user data tables.

B.3. 约定

代号 (以及术语缩写)

ACID

Atomic, Consistent, Isolated, and Durable

ASCII

American Standard Code for Information Interchange

API

Application Program Interface

BLOB

Binary Large OBject

CLI

Call-Level Interface

COTS

Commercial Off The Shelf

DEM

Digital Elevation Model

GPKG

GeoPackage

GRD

Ground Resolved Distance

EPSG

European Petroleum Survey Group

FK

Foreign Key

IETF

Internet Engineering Task Force

IIRS

Image Interpretability Rating Scale

IRARS

Imagery Resolution Assessments and Reporting Standards (Committee)

ISO

International Organization for Standardization

JDBC

Java Data Base Connectivity

JPEG

Joint Photographics Expert Group (image format)

MIME

Multipurpose Internet Mail Extensions

NIIRS

National Imagery Interpretability Rating Scale

OGC

Open Geospatial Consortium

PK

Primary Key

PNG

Portable Network Graphics (image format)

RDBMS

Relational Data Base Management System

RFC

Request For Comments

SQL

Structured Query Language

SRID

Spatial Reference (System) Identifier

UML

Unified Modeling Language

UTC

Coordinated Universal Time

XML

eXtensible Markup Language

1D

One Dimensional

2D

Two Dimensional

3D

Three Dimensional

B.4. 提交组织 (资料性的)

The following organizations submitted this Encoding Standard to the Open Geospatial Consortium Inc. as a Request For Comment (RFC).

  • Envitia

  • Luciad

  • Sigma Bravo

  • The Carbon Project

  • U.S. Army Geospatial Center

  • U.S. National Geospatial Intelligence Agency

B.5. 文档贡献者及联系方式 (资料性的)

All questions regarding this document should be directed to the editor or the contributors:

Table 18. Document contributors
Name Organization Email

Brett Antonides

LNM Solutions

brett.antonides<at>lmnsolutions.com

Kevin Backe

U.S. Army Geospatial Center GASD

Kevin.Backe<at>usace.army.mil

Roger Brackin

Envitia

roger.brackin<at>envitia.com

Scott Clark

LNM Solutions

scott.clark<at>lmnsolutions.com

David Cray

U.S. Army Geospatial Center GASD

David.Cray<at>usace.army.mil

Paul Daisey

Image Matters

pauld<at>imagemattersllc.com

Nathan P. Frantz

U.S. Army Geospatial Center ERDC

Nathan.P.Frantz<at>usace.army.mil

Alessandro Furieri

Spatialite

a.furieri<at>lqt.it

Randy Gladish

Image Matters

randyg<at>imagemattersllc.com

Eric Gundersen

MapBox

eric<at>mapbox.com

Brad Hards

Sigma Bravo

bhards<at>sigmabravo.com

Jeff Harrison

The Carbon Project

jharrison<at>thecarbonproject.com

Chris Holmes

OpenGeo

cholmes<at>9eo.org

Sean Hogan

Compusult

sean<at>compusult.net

Kirk Jensen

Image Matters

kirkj<at>imagemattersllc.com

(chinese chars not working) Joshua

Feng China University

joshua<at>gis.tw

Terry A. Idol

U.S. National Geospatial Intelligence Agency

Terry.A.Idol<at>nga.mil

Drew Kurry

Digital Globe

dkurry<at>digitalglobe.com

Steven Lander

Reinventing Geospatial

steven.lander<at>rgi-corp.com

Tom MacWright

MapBox

tom<at>mapbox.com

Joan Maso Pau

Universitat Autònoma de Barcelona (CREAF)

joan.maso<at>uab.es

Kevin S. Mullane

U.S. Army Geospatial Center GASD

Kevin.S.Mullane<at>usace.army.mil

(chinese chars not working) Yi-Min Huang

Feng China University

niner<at>gis.tw

Andrea Peri

Regione Toscana Italy

andrea.peri<at>regione.toscana.it

Paul Ramsey

OpenGeo

pramsey<at>opengeo.org

Matthew L. Renner

U.S. Army Geospatial Center ERDC

Matthew.L.Renner<at>usace.army.mil

Even Rouault

Mines-Paris

even.rouault<at>mines-paris.org

Keith Ryden

Environmental Systems Research Institute

kryden<at>esri.com

Scott Simmons

CACI

scsimmons<at>caci.com

Ingo Simonis

International Geospatial Services Institute

ingo.simonis<at>igsi.eu

Raj Singh

Open Geospatial Consortium

rsingh<at>opengeospatial.org

Steve Smyth

Open Site Plan

steve<at>opensiteplan.org

Donald V. Sullivan

U.S. National Aeronautics and Space Administration

donald.v.sullivan<at>nasa.gov

Christopher Tucker

Mapstory

tucker<at>mapstory.org

Benjamin T. Tuttle

U.S. National Geospatial Intelligence Agency

Benjamin.T.Tuttle<at>nga.mil

Pepijn Van Eeckhoudt

Luciad

pepijn.vaneeckhoudt<at>luciad.com

David G. Wesloh

U.S. National Geospatial Intelligence Agency

David.G.Wesloh<at>nga.mil

Jeff Yutzler

Image Matters

jeffy<at>imagemattersllc.com

Eric Zimmerman

U.S. Army Geospatial Center ERDC

Eric.Zimmerman<at>usace.army.mil

B.6. 版本历史 (资料性的)

Table 19. Revision History
Date Rel Editor Paragraph modified Description

2012-11-15

r1

Paul Daisey

10.3

Remove min/max x/y fields from all tables and text in clause 10.3 Tile Table Metadata per change request 250 / 12-135.

2012-11-15

r1

Paul Daisey

10.2, Annex B

add compr_qual_factor and georectification columns to raster_columns table create statement and sample insert statement; add triggers for those columns matching those for _rt_metadata per change request 251 / 12-134

2013-01-15

r2

Paul Daisey

8.2

Change gpkg_contents description default value per change request 255 / 12-166

2013-01-15

r2

Paul Daisey

9.2, Annex A

SRS Table Name Change per change request 256 / 12-165

2013-01-16

r2

Paul Daisey

7, Figure 2

table diagram gpkg_contents min_y REAL instead of BLOB

2013-01-23

r2

Paul Daisey

11.3, 8.2

Clause reference corrections, change gpkg_contents.identifier default value to ""

2013-02-01

r2

Paul Daisey

Changes to AS

No changes to AS

2013-02-01

r2

Paul Daisey

8.2

new last sentence and NOTE1, additional table name triggers

2013-02-01

r2

Paul Daisey

9.6

drop tables 21, 22 and associated text

2013-02-01

r2

Paul Daisey

10.5

misc. editorial changes

2013-02-01

r2

Paul Daisey

11.2

REQ 71 should refer to clause 11.2 and not 11.1

2013-02-01

r2

Paul Daisey

12

new clause 12 other data

2013-02-01

r2

Paul Daisey

13.2

rename tables 56,57 remove "ows_" prefix

2013-02-08

r3

Paul Daisey

10.2, 10.7, 10.8

Use -1 as "magic" value indicating "unknown" for both compr_qual_factor and georectification columns, and make it the default value. Remove NOTE1 in 10.7. Delete the next to last row in Table 46 - Image Routines for gpkgBboxToTiles (). Delete the corresponding sub-clause 10.8.10 Renumber sub-clause 10.8.11 to 10.8.10

2013-02-22

R3

Paul Daisey

Normative References, Future Work, 6, Bibliography

The GeoPackage file format and SQL API are provided by SQLite, which is the GeoPackage container implementation, not just a a reference implementation.

2013-03-05

R3

Paul Daisey

6.4

Add Security Considerations clause.

2013-03-05

R3

Paul Daisey

Future Work

Streaming synchronization

2013-03-30

R3

Paul Daisey

Normative References, All, Bibliography

Move references to geos and proj4 libraries from Normative References to Bibliography, remove references to them from main text.

2013-03-30 2013-04-01

R3

Paul Daisey

Reorganize document and Annexes

New Core / Extension outline.

2013-03-30

R3

Paul Daisey

6.3.2.2

auth_name column case-insensitive

2013-03-30

R3

Paul Daisey

Add feature table layout example

2013-04-01

R3

Paul Daisey

All,Annex B

Move table definition SQL to Annex B

2013-04-01

R3

Paul Daisey

7.2.4

Remove requirements for SQL/MM functions, REQ 21 – 33.

2013-04-03

R3

Paul Daisey

All

Renumber tables, figures, normative references

2013-04-09

R4

Paul Daisey

6.3.6

Make integer primary keys mandatory for user vector, raster and tile data tables.

2013-04-09

R4

Paul Daisey

6.3.3.2,

Rewrite clause, remove references to geometry_columns table columns that are superfuluous in SQLite implementation.

2013-04-09

R4

Paul Daisey

6.3.6.1

Rewrite clause, remove references to SF/SQL gS and gB architectures.

2013-04-18

R4

Paul Daisey

6.3.4.1, 6.3.4.2, 6.3.6.3

Remove normative references to RasterLite

2013-04-19

R4

Paul Daisey

6.3.6.3

GeoPackage description of other data tables.

2013-04-29

R4

Paul Daisey

All

Remove implementation references

2013-04-29

R4

Paul Daisey

6.3.6.3, Annex G

Remove manifest other data entries

2013-04-29

R4

Paul Daisey

6.3.2.4.2, Annex B, E

Allow metadata of specified MIME type

2013-04-29

R4

Paul Daisey

6.3.2.4.3, Annex B, E

Allow NULLs in metadata_reference table

2013-04-29

R4

Paul Daisey

6.3.3.2, new Annex F

Geometry type codes

2013-04-29

R4

Paul Daisey

6.3.2.4, new Annex L

Feature Schema Metadata example

2013-05-03

R5

Paul Daisey

Future Work

Geographic / Geodetic Geometries

2013-05-07

R5

Paul Daisey

6.3.4.2, Annex C, E

Remove compr_qual_factor and georectification columns from raster_columns table

2013-05-07

R5

Paul Daisey

6.3.2.4, 6.3.4.3, new Annex M

delete _rt_metadata tables add Annex M reference Annex M from note in 6.3.2.4

2013-05-07

R5

Paul Daisey

7.1.1, Normative References, Bibliography

Add NITF as an extension image format

2013-05-07

R5

Paul Daisey

6.3.1

Revise Table Diagram

2013-05-07

R5

Paul Daisey

7.3.3, Annex C

Remove raster functions

2013-05-11

R5

Paul Daisey

6.3.2.4.3

metadata_reference table is not required to contain any rows

2013-05-11

R5

Paul Daisey

6.3.2.4.2

Recommend ISO 19139 metadata

2013-05-11

R5

Paul Daisey

6.3, Annex B

Default values

2013-05-11

R5

Paul Daisey

7.3.3, Annex C

Minimal Runtime SQL Functions

2013-05-11

R5

Paul Daisey

7.3.4, Annex D

Spatial Indexes

2013-05-13

R5

Paul Daisey

6, 7

Reformat requirement tables, unduplicate requirement text

2013-05-15

R5

Paul Daisey

6.3.1, 6.3.2.4, 6.3.4.2, 7.3.5.5, Annex B, remove Annex L

Replace raster_columns table, Annex L with gpkg_data_columns table

2013-05-16

R5

Paul Daisey

6.3.2.3, 7.4, Annex G,H,I

Drop manifest table, schemas, sample document

2013-05-16

R5

Paul Daisey

Future Work

Add GeoPackage Abstract Object Model

2013-05-22

R5

Paul Daisey

6.2.1, 6.3.3.1, new 7.1.1, Annex F

Add optional support for non-linear geometry types

2013-05-22

R5

Paul Daisey

7.3.2

Add SQLite configuration requirements

2013-05-22

R5

Paul Daisey

6.3, 7.2

Require only gpkg_contents and spatial_ref_sys tables

2013-05-24

R5

Paul Daisey

7.2.1.3

Add gpkg_extensions table

2013-05-24

R5

Paul Daisey

7.3.4, Annex D

Provide spatial index templates instead of examples

2013-05-25

R5

Paul Daisey

Preface, Scope, Terms, 6, 7

Simplify, rewrite, add terms, use terms

2013-05-26

R5

Paul Daisey

All

Incorporate terms, renumber requirements and tables

2013-05-28

R5

Paul Daisey

6.1.2

Add "GPKG" as SQLite application id

2013-05-28

R5

Paul Daisey

6.1.2

Add SQLITE PRAGMA integrity_check

2013-05-28

R5

Paul Daisey

6.2.1

Geometry format minor changes

2013-05-28

R5

Paul Daisey

6.3.2.2, Annex E

Remove references to raster_columns table (removed previously)

2013-05-28

R5

Paul Daisey

All

Clause number references and text changes required by 5/22 changes

2013-05-28

R5

Paul Daisey

All

Remove comments on accepted changes

2013-05-28

R5

Paul Daisey

Annex E E.4

Add non-linear geometry type codes

2013-05-29

R5

Paul Daisey

7.2.4.1

Change reference from SF/SQL to SQL/MM

2013-05-29

R5

Paul Daisey

All

Change core and extension requirement names required by 5/22 changes

2013-05-29

R5

Paul Daisey

Table 16

Change extension to API to avoid overloading extension term

2013-05-29

R5

Paul Daisey

A.2

Draft changes to A.2 Conformance Classes

2013-05-29

R5

Paul Daisey

B.3

Add gpkg_data_columns table SQL

2013-05-30

R5

Paul Daisey

Revision History

Record 5/29 changes

2013-06-06

R6

Paul Daisey

Preface, Submission Contact Points, Revision History, Changes to AS, Changes to IS, Future Work, Forward, Introduction, Clauses 1-5

Remove all forward material except title page, submitting orgs, and introduction, and put in annexes.

2013-06-07

R6

Paul Daisey

Old Clauses 6,7 → New 1-3

Restructure document iaw draft Requirements Dependencies

2013-06-07

R6

Paul Daisey

Annex A

Revised Requirements Dependencies and Diagram

2013-06-10

R6

Paul Daisey

All

Fix clause and requirement references based on document restructure

2013-06-10

R6

Paul Daisey

Annex A

Add Abstract Test Suite (incomplete)

2013-06-11

R6

Paul Daisey

Clause 1,2, Annex A

Insert Base and Extension subclauses, renumber more deeply nested subclauses

2013-06-12

R6

Paul Daisey

Annex G

Remove names and codes for Z and M geometry types, add Figure 5 and geometry subtype definitions

2013-06-12

R6

Paul Daisey

Clause 1.2.2.6

Rewrite clause, add new Requirement 10, 11, renumber existing and subsequent ones.

2013-06-12

R6

Paul Daisey

Annex D

Add ST_Is3D() and ST_IsMeasured()

2013-06-12

R6

Paul Daisey

All

Add "gpkg_" prefix to all GeoPackage metadata tables

2013-06-12

R6

Paul Daisey

Figure 1, 2

Update with "gpkg_" prefix

2013-06-12

R6

Paul Daisey

Annex A

Add Abstract Test Suite (incomplete)

2013-06-13

R6

Paul Daisey

1.2.4.1

Add sentence to end of first paragraph describing gpkg_other_data_columns content..

2013-06-13

R6

Paul Daisey

Annex A

Add Abstract Test Suite (incomplete)

2013-06-17

R6

Paul Daisey

Clause 1,2,3

Revised notes and turned them into footnotes; moved normative text into requirement statements.

2013-06-20

R6

Paul Daisey

All

Restructure document iaw SpecificationStructureAlternative3

2013-06-24

R6

Pepijn Van Eeckhoudt

All

Created and applied Word Styles and Outline List Numbering

2013-06-26

R6

Paul Daisey

1.1.2, 2.1.1, 2.1.4, 3.1.2, Annex C, D, F, G

GeoPackage Geometry Encoding Revisions

2013-06-27

R6

Paul Daisey

3.1.3.1.1

Add footnote recommendation on Spatial Index drop/add if many updates.

2013-06-27

R6

Paul Daisey

Figure 1, 2.2.6, 2.2.7

Remove gpkg_tile_table_metadata table

2013-06-28

R6

Paul Daisey

All

Change requirement statement format to Req # s SHALL o in bold italic

2013-06-28

R6

Paul Daisey

Annex B

Update definition of Empty GeoPackage, add definition of Valid GeoPackage

2013-06-28

R6

Paul Daisey

Figure 1, 2.2.7, Annex C, F

Change tile_matrxI_metadata t_table_name column name to table_name iaw changes to gpkg_geometry_columns column name changes.

2013-06-28

R6

Paul Daisey

Figure 1, 2.1.5, 2.2.7, Annex C, F

Add gpkg_geometry_columns and gpkg_tile_matrix_metadata table_name foreign key constraints referencing gpkg_contents table_name now that gpkg_contents rows may describe other data tables.

2013-06-28

R6

Paul Daisey

Clause 3

Tables with non "gpkg" author registered extensions not data_type "features" or "tiles"

2013-07-01

R7

Paul Daisey

Annex A

Change ATS format from numbered list to bold heading, add test definitions.

2013-07-02

R7

Paul Daisey

Annex A

Add test definitions.

2013-07-03

R7

Paul Daisey

Annex A

Revise, add test definitions.

2013-07-04

R7

Paul Daisey

1.1.1, Annex A

Change .geopackage to .gpkg

2013-07-24

R7

Paul Daisey

Annex B

Add "Potential" to "Future Work", "MAY" to items.

2013-07-24

R7

Paul Daisey

Annex B

Add support for UTFGrid as a future work item.

2013-07-24

R7

Paul Daisey

1.1.1.1.1

Add footnote to REQ 1 that SQLite is in the public domain.

2013-07-24

R7

Paul Daisey

2.1.3.1.1

Add footnote to Table 4 that OGC WKB is subset of ISO WKB

2013-07-24

R7

Paul Daisey

2.1.3.1.1

Revise definition of geometry type in Table 4 to include is_empty flag; add paragraph on encoding empty point geometries.

2013-07-24

R7

Paul Daisey

Annex E

Revise spatial index triggers to handle NULL values.

2013-07-31

R7

Paul Daisey

Annex C, F

Correct SQL errors in tables 13, 32, 43

2013-07-31

R7

Paul Daisey

Annex D

Add ST_IsEmpty(geom. Geometry)

2013-07-31

R7

Paul Daisey

Annex E Table 39

Revise spatial index triggers to handle empty geometries, changed ROWID values.

2013-07-31

R7

Paul Daisey

Annex A A.3.1.3.1.1

Revise test method iaw changes to spatial index triggers

2013-07-31

R7

Paul Daisey

2.1.3.1.1

Envelope in geopackage geometry binary for empty geometry

2013-07-31

R7

Paul Daisey

Annex A A.2.1.2.1.1

Revise test method to test for NaN values in envelope of empty geometries

2013-08-01

R8

Paul Daisey

Submitting Organizations, Submission Contact Points

Moved Submitting Organizations to B2; deleted previous B2 Submission Contact Points

2013-08-01

R8

Paul Daisey

1.1.3.1.1 Table 3, 2.1.6.1.2, Annex A, C

Nullable gpkg_contents columns One geometry column per feature table.

2013-09-09

R8

Paul Daisey

Clause 3

Add new Req 67 re gpkg_extensions table

2013-09-09

R8

Paul Daisey

2.1.6.1.1

remove footnote 1

2013-09-09

R8

Paul Daisey

2.1.6.1.1, Annex C

change no to yes for null in Table 6, 27 except for id column

2013-09-09

R8

Paul Daisey

1.1.3.1.1

Req 12 add gpkg_ prefix to gpkg_spatial_ref_sys

2013-09-09

R8

Paul Daisey

2.2

remove "with compression" and "without compression from footnote 1

2013-09-09

R8

Paul Daisey

2.6.1.1.1

"an all of" changed to "all"

2013-09-09

R8

Paul Daisey

2.2.6.1.2, Annex A

Add gpkg_ prefix to gpkg_tile_matrix_metdata

2013-09-09

R8

Paul Daisey

2.2.7.1.1

Space between 8and

2013-09-09

R8

Paul Daisey

2.2.6.1.1

Table 7 {rasterlayername}_tiles change to Tile Matrix User Data Table Name

2013-09-09

R8

Paul Daisey

3.1.3.1.2, 3.2.1.1.2, Annex C

Change gpkg_extension to gpkg_extensions

2013-09-09

R8

Paul Daisey

3.2.3.1.1

Remove [29] from GeoTiff, change [31] to [29] for NGA Implementation Profile

2013-09-09

R8

Paul Daisey

Annex A

change "first three bytes of each gc are not "GPB"" to "first two bytes of each gc are not "GP"

2013-09-09

R8

Paul Daisey

Annex A

Change (1,2,3) to (0,1,2)

2013-09-09

R8

Paul Daisey

Annex D

add INTEGER return type to ST_ISEmpty, ST_Is3D, ST_ISMeasured functions

2013-09-09

R8

Paul Daisey

2.1.1

Add "more"

2013-09-09

R8

Paul Daisey

Annex C

Add the following constraint to the gpkg_geometry_columns table: CONSTRAINT uk_gc_table_name UNIQUE (table_name),

2013-09-09

R8

Paul Daisey

3.1.4.1.2, 3.1.5.1.2

Change geopackage_extension to gpkg_extensions

2013-09-18

R8

Paul Daisey

2.6.1, Annex A, Annex C

Add column scope text not null to gpkg_extensions

2013-09-18

R8

Paul Daisey

2.5

Reword clause 2.5 to preclude reference to other data tables by rows in gpkg_geometry_columns or gpkg_tile_matrix_metadata tables. Add data_type constraint to Req 19. Add data_type constraint to Annex A tests.

2013-09-18

R8

Paul Daisey

3.1, 3.3, Annex A, Annex D

Rename clause 3.3 Other Tables Move clause 3.1.1 Geometry Encoding to clause 3.3.1 Other Geometry Encoding Move clause 3.2.5 Tile Encoding Other to clause 3.3.2 Other Tile Encoding Rename clause 3.3.1 Other Trigger to clause 3.3.3 Other Trigger Renumber contained requirements Add footnote to Annex D table Move corresponding tests in Annex A

2013-09-24

R8

Paul Daisey

Annex E

Replace all occurences of rowid with <i> in trigger definitions.

2013-09-24

R8

Paul Daisey

All

Update normative [xx]and bibliographic [Byy] references

2013-09-25

R8

Paul Daisey

3.1, Annex A, Annex D, Annex F

Change geometry_columns to gpkg_geometry_columns and geometry_type to geometry_type_name

2013-09-25

R8

Paul Daisey

2.2.3, 3.2.1, new Annex I

Change "power" to "factor" in and add text to zoom level descriptions and requirements.

2013-09-25

R8

Paul Daisey

2.1.6, Annex A, Annex C

Add required data types for vector feature user data table column definitions.

2013-09-26

R8

Paul Daisey

New 2.3.2, Annex A, Annex C

Add gpkg_data_column_constraints table

2013-09-26

R8

Paul Daisey

1.1.3, 2.2.1, 2.2.6, 2.2.7, 2.2.8, Annex A, Annex C

Add gpkg_tile_matrix_set, rename gpkg_tile_matrix_metadata to gpkg_tile_matrix, standardize tile pyramid, tile matrix set and tile matrix term usage.

2013-09-27

R8

Paul Daisey

Figure 1

Added gpkg_tile_matrix_set, gpkg_data_columns_constraints to Figure 1

2013-09-27

R8

Paul Daisey

2.1.5.1

Replace normative text in 2.1.5.1.1 with new requirement 19 in 2.1.5.1.2.

2013-09-27

R8

Paul Daisey

All

Clarify which tables may be implemented as views or extended with additional columns.

2013-09-27

R8

Paul Daisey

2.4.2.1.1

Drop md_standard_uri default value, add footnote and text paragraph.

2013-09-27

R8

Paul Daisey

All

Specify case sensitivity for required column values.

2013-09-27

R8

Paul Daisey

All

Change SQL trigger action from ROLLBACK to ABORT

2013-10-02

R9

Paul Daisey

1.1.2.1.1, Annex A

Add Null column to table 2 per table 22, remove default value, foreign and unique key tests from Annex A A.1.1.2.1.1

2013-10-02

R9

Paul Daisey

All

Misc. Editorial corrections.

2013-10-02

R9

Paul Daisey

Title Page

Changed title from Implementation Specification to Encoding Standard per Carl Reed email.

2013-10-04

R9

Paul Daisey

1.1.1.1.3, Annex A

Add new Req 4 requirement for SQLite PRAGMA foreign_key_check()

2013-10-04

R9

Paul Daisey

All

Disallow addition of columns to all gpkg tables except user data feature tables.

2013-10-05

R9

Paul Daisey

Introduction, All, Annex B

GeoPackage replaces GeoPackage file

2013-10-05

R9

Paul Daisey

Introduction, 1.1.1.1.1, Annex B

Add Extended GeoPackage definition

2013-10-05

R9

Paul Daisey

Introduction Figure 1, 2.6, Annex C

Add definition column to gpkg_extensions table.

2013-10-05

R9

Paul Daisey

Introduction, Annex B

Add GeoPackage SQLite Configuration definition

2013-10-05

R9

Paul Daisey

Introduction, Annex B

Modify definition of GeoPackage SQLite Extension

2013-10-05

R9

Paul Daisey

1

Revise Container Definition, add new Req 1 and Req 3

2013-10-05

R9

Paul Daisey

1.1.1.2.2

Remove rows from Table 1 SQLite Configuration

2013-10-05

R9

Paul Daisey

2.1.3.2

Drop clause. Required SQL functions to be defined in extension template documents.

2013-10-05

R9

Paul Daisey

2.5.1

New Introduction clause for Extension Mechanism

2013-10-05

R9

Paul Daisey

2.5.2.1.2

New Req 79, Req 83, revised Req 82, added explanatory text for Req 84, deleted Table 47

2013-10-07

R9

Paul Daisey

1.1.1.2.2

Move foreign key rows from Table 9 Safe GeoPackage to Table 1 SQLite Configuration

2013-10-07

R9

Paul Daisey

2.5.2.1

Extend Req 79 with semantic equivalence of empty and missing gpkg_extensions table.

2013-10-07

R9

Paul Daisey

2.5.2.2

Drop Clasue. Required SQL Configuration settings to be defined in extension template documents.

2013-10-07

R9

Paul Daisey

3.1.2

New clause for Geometry Encoding Extension

2013-10-07

R9

Paul Daisey

Annex J - S

New Extension Template and Extension Annexes

2013-10-08

R9

Paul Daisey

1.1.1.2.2, Annex M, N, O

Prohibit all SQLITE_OMIT_* compile time options instead of specific ones.

2013-10-09

R9

Paul Daisey

3.\*.1.1

Simplify extension prerequisite descriptions, reference extension annexes.

2013-10-09

R9

Paul Daisey

Annexes J - S

Style subheadings as subtitles, add clause references

2013-10-09

R9

Paul Daisey

2.1.3, Annex L

Replace GeoPackageBinary definition with StandardGeoPackageBinary definition.

2013-10-09

R9

Paul Daisey

Introduction, 2.3.2, 2.3.3, Annex C

  1. Drop constraint_type column from gpkg_data_columns, Req 60

  2. Add Req 61

  3. Change description of constraint name.

  4. Revise Figure 1 Table Diagram

2013-10-09

R9

Paul Daisey

2.5.2.1.2

Add guidance for extension template

2013-10-09

R9

Paul Daisey

2.1.6.1.2

Add footnote re further restrictions on the geometry types that are allowed in a feature table

2013-10-09

R9

Paul Daisey

2.1.3.1.1

Add footnote that WKB geometries are not geographic / geodesic

2013-10-10

R9

Paul Daisey

1.1.1.1.2

Change Req 3 SQLite database header required contents to include version number.

2013-10-10

R9

Paul Daisey

Annex A

Add and revise tests in accordance with other R9 draft changes.

2013-10-10

R9

Paul Daisey

2.3.3, Annex A

Add unique key on gpkg_data_column_constraints constraint_name, constraint_type, constraint_value columns; Add new Req 63, ATS test

2013-10-15

R9

Paul Daisey

Annex D

Drop D.1 Geometry Column Triggers

2013-10-15

R9

Paul Daisey

Annex F

Drop Annex F

2013-10-15

R9

Paul Daisey

2.3.3.1.2

Remove first sentence on constrain name column values.

2013-10-15

R9

Paul Daisey

Introduction, 2.3.3.1.1, Annex C

Add description column to gpkg_data_column_constraints table.

2013-10-15

R9

Paul Daisey

2.3.3.1.2

Drop requirement 61

2013-10-15

R9

Paul Daisey

2.1.6.1.2

Drop footnote 2 on p.13

2013-10-15

R9

Paul Daisey

2.1.6.1.1

Delete DECIMAL_TEXT row from Table 6

2013-10-15

R9

Paul Daisey

1.1.1.1.1

Move to 1.1.1.1.3, renumber requirements.

2013-10-15

R9

Paul Daisey

2.1.6.1.1, 1.1.1.1.3

Move Req 30 and Table 6 to Req5 and Table 1

2013-10-15

R9

Paul Daisey

2.4.3.1.1, Annex C

Change timestamp column from TEXT to DATETIME data type

2013-10-15

R9

Paul Daisey

All

Change data types to those specified in Table 1

2013-10-15

R9

Paul Daisey

2.3.3.1.1

Add NUMERIC data type footnote for table gpkg_data_column_constraints

2013-10-15

R9

Paul Daisey

All

Misc editorial changes

2013-10-22

R9

Paul Daisey

3.2.3, 3.2.4, Annex A

Remove TIFF and NITF tile encodings

2013-10-22

R9

Paul Daisey

New 3.1.2.1.4, Annex A

New Req 91

2013-10-22

R9

Paul Daisey

Annex K

Rewrite requirement description

2013-10-22

R9

Paul Daisey

3.1.1, 3.1.2, Annex J, K

Renamed

2013-10-22

R9

Paul Daisey

All

Misc editorial changes

2013-10-22

R9

Paul Daisey

Introduction, Annex B

Replace detailed table diagram in Introduction with an overview diagram; move detailed table diagram to Annex B, add minimal features and tiles diagrams to Annex B.

2013-10-24

R9

Paul Daisey

1.1.1.1.3

Specify 8601 formats for DATE and DATETIME in Table 1

2013-10-24

R9

Paul Daisey

1.1.1.1.3

{(size)} specs for BLOB and TEXT data types in Table 1

2013-10-24

R9

Paul Daisey

2.1.3.1.1 Table 5

Bit layout of flags byte and flag bits use — additional text

2013-10-24

R9

Paul Daisey

All

Misc editorial changes

2013-10-24

R9

Paul Daisey

Annex Q, R

Removed

2013-10-24

R9

Paul Daisey

All, Annex S, T

Remove unused normative [xx]and bibliographic [Byy] references, update remaining ones

2013-11-11

R9

Paul Daisey

All

Misc editorial changes, mostly formatting.

2013-11-12

R9

Paul Daisey

Annex C, G

Correct gpkg_metadata table definition SQL default values, metadata column type from BLOB to TEXT

2013-11-12

R9

Paul Daisey

1.1.1.1.1

Add footnote (3) to Req 2

2013-11-12

R9

Paul Daisey

Annex L, O

2013-11-12

R9

Paul Daisey

2.2.6.1.1, 2.2.6.1.2

Cut sentence from 2.2.6.1.1, paste revised version and additional sentence describing origin georeferenced coordinates to 2.2.6.1.2.

2013-11-12

R9

Paul Daisey

2.3.3.1.2

Add a new third sentence in first paragraph; add new Table 13 example

2013-11-12

R9

Paul Daisey

1.1.3.1.1, 2.1.3.1.1, 2.2.6.1.1

Add x/y axis definitions to min/max x/y column descriptions and WKB geometry description.

2013-11-13

R9

Paul Daisey

1.1.1.1.1

Revise footnote (3) to Req 2 to include byte values instead of long value.

2013-11-13

R9

Jeff Yutzler, Paul Daisey

All

Misc editorial changes, mostly formatting.

2013-11-18

R9

Paul Daisey

1, 2.1.6.1.1, 2.2.8.1.1

Add "and table constraints" in clause 1, make INTEGER PRIMARY KEY AUTOINCREMENT explicit in Req 29 and Req 52 to avoid future "WITHOUT ROWID" SQLite v3.8.2 problems.

2013-11-19

R9

Jeff Yutzler, Paul Daisey

All

Misc formatting changes.

2013-11-21

R10

Paul Daisey

1.1.1.4

Remove "()" from PRAGMA foreign_key_check()

2013-11-21

R10

Paul Daisey

Annex C, G

Change metadata_standard_uri column name to md_standard_uri

2013-12-26

R10

Paul Daisey

A.1.1.2.1.2

Use the current gpkg_spatial_ref_sys table and column name definitions

2013-12-28

R10

Paul Daisey

Annex Q

Add normative reference [32] to OpenGIS® 01-009

2013-12-28

R10

Paul Daisey

1.1.2.1.1

Add normative reference “[32]” to description of definition column in Table 3

2013-12-28

R10

Paul Daisey

A.1.1.2.1.2

/base/core/gpkg_spatial_ref_sys/data_values_default revise step 3 SQL

2013-12-28

R10

Paul Daisey

1.1.2.1.2

Add paragraph on definition column WKT values

2013-12-31

R10

Paul Daisey

All

Misc editorial corrections.

2013-12-31

R10

Paul Daisey

A.2.2.3.1.1, A.2.2.4.1.1

Change “extension_name IN ('gpkg_webp’,’gpkg_tiff’,’gpkg_nitf’)” to “extension_name = ‘gpkg_webp’”

2013-12-31

R10

Paul Daisey

A.2.5.1.1.2

delete test steps 7 and 8:re tile encoding TIFF and NITF

2013-12-31

R10

Paul Daisey

2.2.7.1.1

remove the default column from Table 9

2013-12-31

R10

Paul Daisey

2.2.8.1.1

remove 3.2.3, 3.2.4 from table 10 tile_data column description

2013-12-31

R10

Paul Daisey

Annex D.5

Change t_table_name to table_name in Table 41

2013-12-31

R10

Paul Daisey

2.1.5.1.2

Change “each geometry column” to “the geometry column” in Req 22

2014-01-10

R10

Paul Daisey

1.1.2.1.1

Rename Table 3 Spatial Ref Sys Table Definition

2014-01-28

R10

Paul Daisey

1.1.3.1.1, 2.4.3.1.1, Annex C, Annex H

strftime(%Y-%m-%dT%H:%M:%fZ, CURRENT_TIMESTAMP) changed to strftime(%Y-%m-%dT%H:%M:%fZ,now)

B.7. OGC® 抽象规范的变更

The OGC® Abstract Specification does not require changes to accommodate this OGC® standard.

B.8. OGC® 执行标准的变更

None at present.

B.9. 潜在的未来工作 (资料性的)

  • MAY investigate GeoPackage implementation on SQLite version 4 [B25].

  • Future versions of this specification MAY include requirements for elevation data and routes.

  • Future enhancements to this specification, a future GeoPackage Web Service specification and modifications to existing OGC Web Service (OWS) specifications to use GeoPackages as exchange formats MAY allow OWS to support provisioning of GeoPackages throughout an enterprise.

  • Future versions of this specification MAY include additional raster / image formats, including fewer restrictions on the image/tiff format.

  • Future versions of this specification MAY include additional SQL API routines for interrogation and conversion of raster / image BLOBs.

  • Future versions of this specification and/or one for a GeoPackage Web Service MAY address utilities for importing and exporting vector, raster and tile data in various formats.

  • Future versions of this specification and/or one for a GeoPackage Web Service MAY address encryption of GeoPackages and/or individual tables or column values.

  • Future versions of this specification MAY add infrastructure to the metadata tables such as a temporal_columns table that refers to the time properties of data records.

  • MAY specify a streaming synchronization protocol for GeoPackage as part of a future GeoPackage Web Service specification, and/or a future version of the GeoPackage and/or Web Synchronization Service specification(s).

  • Future versions of this specification MAY address symbology and styling information.

  • Future version of this specification MAY include geographic / geodesic geometry types.

  • MAY create a GeoPackage Abstract Object Model to support data encodings other than SQL in a future version of this specification.

  • MAY add UTFGrid support in a future version of this specification

B.10. UML 标记

The diagrams that appear in this standard are presented using the Unified Modeling Language (UML) [B14] static structure diagrams. The UML notations used in this standard for RDBMS tables in a GeoPackage are described in UML Notation for RDBMS Tables below.

umlnotationforrdbmstables
Figure 3. UML Notation for RDBMS Tables

In this standard, the following two stereotypes of UML classes are used to represent RDBMS tables:

  1. <<table>> An instantiation of a UML class as an RDMBS table.

  2. <<column>> An instantiation of a UML attribute as an RDBMS table column.

In this standard, the following standard data types are used for RDBMS columns:

  1. NULL – The value is a NULL value.

  2. INTEGER – A signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value

  3. REAL – The value is a floating point value, stored as an 8-byte IEEE floating point number.

  4. TEXT – A sequence of characters, stored using the database encoding (UTF-8, UTF-16BE or UTF-16LE).

  5. BLOB – The value is a blob of data, stored exactly as it was input.

  6. NONE – The value is a Date / Time Timestamp

B.11. GeoPackage 表的详细图解

geopackage uml
Figure 4. GeoPackage Tables Details

B.12. 几何要素相关的最少GeoPackage表图解

geopackage features
Figure 5. GeoPackage Minimal Tables for Features

B.13. 瓦片相关的最少GeoPackage表图解

geopackage tiles
Figure 6. GeoPackage Minimal Tables for Tiles

Annex C: 表的SQL定义(规范性的)

C.1. gpkg_spatial_ref_sys

Table 20. gpkg_spatial_ref_sys Table Definition SQL
CREATE TABLE gpkg_spatial_ref_sys (
  srs_name TEXT NOT NULL,
  srs_id INTEGER NOT NULL PRIMARY KEY,
  organization TEXT NOT NULL,
  organization_coordsys_id INTEGER NOT NULL,
  definition  TEXT NOT NULL,
  description TEXT
);
Table 21. SQL/MM View of gpkg_spatial_ref_sys Definition SQL (Informative)
CREATE VIEW st_spatial_ref_sys AS
  SELECT
    srs_name,
    srs_id,
    organization,
    organization_coordsys_id,
    definition,
    description
  FROM gpkg_spatial_ref_sys;
Table 22. SF/SQL View of gpkg_spatial_ref_sys Definition SQL (Informative)
CREATE VIEW spatial_ref_sys AS
  SELECT
    srs_id AS srid,
    organization AS auth_name,
    organization_coordsys_id AS auth_srid,
    definition AS srtext
  FROM gpkg_spatial_ref_sys;

C.2. gpkg_contents

Table 23. gpkg_contents Table Definition SQL
CREATE TABLE gpkg_contents (
  table_name TEXT NOT NULL PRIMARY KEY,
  data_type TEXT NOT NULL,
  identifier TEXT UNIQUE,
  description TEXT DEFAULT '',
  last_change DATETIME NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
  min_x DOUBLE,
  min_y DOUBLE,
  max_x DOUBLE,
  max_y DOUBLE,
  srs_id INTEGER,
  CONSTRAINT fk_gc_r_srs_id FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys(srs_id)
);

C.3. gpkg_geometry_columns

Table 24. gpkg_geometry_columns Table Definition SQL
CREATE TABLE gpkg_geometry_columns (
  table_name TEXT NOT NULL,
  column_name TEXT NOT NULL,
  geometry_type_name TEXT NOT NULL,
  srs_id INTEGER NOT NULL,
  z TINYINT NOT NULL,
  m TINYINT NOT NULL,
  CONSTRAINT pk_geom_cols PRIMARY KEY (table_name, column_name),
  CONSTRAINT uk_gc_table_name UNIQUE (table_name),
  CONSTRAINT fk_gc_tn FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name),
  CONSTRAINT fk_gc_srs FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys (srs_id)
);
Table 25. SQL/MM View of gpkg_geometry_columns Definition SQL (Informative)
CREATE VIEW st_geometry_columns AS
  SELECT
    table_name,
    column_name,
    "ST_" || geometry_type_name,
    g.srs_id,
    srs_name
  FROM gpkg_geometry_columns as g JOIN gpkg_spatial_ref_sys AS s
  WHERE g.srs_id = s.srs_id;
Table 26. SF/SQL VIEW of gpkg_geometry_columns Definition SQL (Informative)
CREATE VIEW geometry_columns AS
  SELECT
    table_name AS f_table_name,
    column_name AS f_geometry_column,
    code4name (geometry_type_name) AS geometry_type,
    2 + (CASE z WHEN 1 THEN 1 WHEN 2 THEN 1 ELSE 0 END) + (CASE m WHEN 1 THEN 1 WHEN 2 THEN 1 ELSE 0 END) AS coord_dimension,
    srs_id AS srid
  FROM gpkg_geometry_columns;
Implementer must provide code4name(geometry_type_name) SQL function

C.4. sample_feature_table (Informative)

Table 27. sample_feature_table Table Definition SQL (Informative)
CREATE TABLE sample_feature_table (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  geometry GEOMETRY,
  text_attribute TEXT,
  real_attribute REAL,
  boolean_attribute BOOLEAN,
  raster_or_photo BLOB
);

C.5. gpkg_tile_matrix_set

Table 28. gpkg_tile_matrix_set Table Creation SQL
CREATE TABLE gpkg_tile_matrix_set (
  table_name TEXT NOT NULL PRIMARY KEY,
  srs_id INTEGER NOT NULL
  min_x DOUBLE NOT NULL,
  min_y DOUBLE NOT NULL,
  max_x DOUBLE NOT NULL,
  max_y DOUBLE NOT NULL,
  CONSTRAINT fk_gtms_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name),
  CONSTRAINT fk_gtms_srs FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys (srs_id)
);

C.6. gpkg_tile_matrix

Table 29. gpkg_tile_matrix Table Creation SQL
CREATE TABLE gpkg_tile_matrix (
  table_name TEXT NOT NULL,
  zoom_level INTEGER NOT NULL,
  matrix_width INTEGER NOT NULL,
  matrix_height INTEGER NOT NULL,
  tile_width INTEGER NOT NULL,
  tile_height INTEGER NOT NULL,
  pixel_x_size DOUBLE NOT NULL,
  pixel_y_size DOUBLE NOT NULL,
  CONSTRAINT pk_ttm PRIMARY KEY (table_name, zoom_level),
  CONSTRAINT fk_tmm_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name)
);
Table 30. EXAMPLE: gpkg_tile_matrix Insert Statement (Informative)
INSERT INTO gpkg_tile_matrix VALUES (
  "sample_tile_pyramid",
  0,
  1,
  1,
  512,
  512,
  2.0,
  2.0
);

C.7. sample_tile_pyramid (Informative)

Table 31. EXAMPLE: tiles table Create Table SQL (Informative)
CREATE TABLE sample_tile_pyramid (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  zoom_level INTEGER NOT NULL,
  tile_column INTEGER NOT NULL,
  tile_row INTEGER NOT NULL,
  tile_data BLOB NOT NULL),
  UNIQUE (zoom_level, tile_column, tile_row)
)
Table 32. EXAMPLE: tiles table Insert Statement (Informative)
INSERT INTO sample_matrix_pyramid VALUES (
  1,
  1,
  1,
  1,
  "BLOB VALUE"
)

C.8. gpkg_data_columns

Table 33. gpkg_data_columns Table Definition SQL
CREATE TABLE gpkg_data_columns (
  table_name TEXT NOT NULL,
  column_name TEXT NOT NULL,
  name TEXT,
  title TEXT,
  description TEXT,
  mime_type TEXT,
  constraint_name TEXT,
  CONSTRAINT pk_gdc PRIMARY KEY (table_name, column_name),
  CONSTRAINT fk_gdc_tn FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name)
);

C.9. gpkg_data_column_constraints

Table 34. gpkg_data_columns Table Definition SQL
CREATE TABLE gpkg_data_column_constraints (
  constraint_name TEXT NOT NULL,
  constraint_type TEXT NOT NULL, // 'range' | 'enum' | 'glob'
  value TEXT,
  min NUMERIC,
  minIsInclusive BOOLEAN, // 0 = false, 1 = true
  max NUMERIC,
  maxIsInclusive BOOLEAN, // 0 = false, 1 = true
  CONSTRAINT gdcc_ntv UNIQUE (constraint_name, constraint_type, value)
)

C.10. gpkg_metadata

Table 35. gpkg_metadata Table Definition SQL
CREATE TABLE gpkg_metadata (
  id INTEGER CONSTRAINT m_pk PRIMARY KEY ASC NOT NULL UNIQUE,
  md_scope TEXT NOT NULL DEFAULT 'dataset',
  md_standard_uri TEXT NOT NULL,
  mime_type TEXT NOT NULL DEFAULT 'text/xml',
  metadata TEXT NOT NULL
);

C.11. gpkg_metadata_reference

Table 36. gpkg_metadata_reference Table Definition SQL
CREATE TABLE gpkg_metadata_reference (
  reference_scope TEXT NOT NULL,
  table_name TEXT,
  column_name TEXT,
  row_id_value INTEGER,
  timestamp DATETIME NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
  md_file_id INTEGER NOT NULL,
  md_parent_id INTEGER,
  CONSTRAINT crmr_mfi_fk FOREIGN KEY (md_file_id) REFERENCES gpkg_metadata(id),
  CONSTRAINT crmr_mpi_fk FOREIGN KEY (md_parent_id) REFERENCES gpkg_metadata(id)
);
Table 37. Example: gpkg_metadata_reference SQL insert statement (Informative)
INSERT INTO gpkg_metadata_reference VALUES (
  'table',
  'sample_rasters',
  NULL,
  NULL,
  '2012-08-17T14:49:32.932Z',
  98,
  99
)

C.12. gpkg_extensions

Table 38. gpkg_extensions Table Definition SQL
CREATE TABLE gpkg_extensions (
  table_name TEXT,
  column_name TEXT,
  extension_name TEXT NOT NULL,
  definition TEXT NOT NULL,
  scope TEXT NOT NULL,
  CONSTRAINT ge_tce UNIQUE (table_name, column_name, extension_name)
);

Annex D: 触发器(Trigger)的SQL定义 (资料性的)

D.1. gpkg_tile_matrix

Table 39. gpkg_tile_matrix Trigger Definition SQL
CREATE TRIGGER 'gpkg_tile_matrix_zoom_level_insert'
BEFORE INSERT ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''gpkg_tile_matrix'' violates constraint: zoom_level cannot be less than 0')
WHERE (NEW.zoom_level < 0);
END

CREATE TRIGGER 'gpkg_tile_matrix_zoom_level_update'
BEFORE UPDATE of zoom_level ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''gpkg_tile_matrix'' violates constraint: zoom_level cannot be less than 0')
WHERE (NEW.zoom_level < 0);
END

CREATE TRIGGER 'gpkg_tile_matrix_matrix_width_insert'
BEFORE INSERT ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''gpkg_tile_matrix'' violates constraint: matrix_width cannot be less than 1')
WHERE (NEW.matrix_width < 1);
END

CREATE TRIGGER 'gpkg_tile_matrix_matrix_width_update'
BEFORE UPDATE OF matrix_width ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''gpkg_tile_matrix'' violates constraint: matrix_width cannot be less than 1')
WHERE (NEW.matrix_width < 1);
END

CREATE TRIGGER 'gpkg_tile_matrix_matrix_height_insert'
BEFORE INSERT ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''gpkg_tile_matrix'' violates constraint: matrix_height cannot be less than 1')
WHERE (NEW.matrix_height < 1);
END

CREATE TRIGGER 'gpkg_tile_matrix_matrix_height_update'
BEFORE UPDATE OF matrix_height ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''gpkg_tile_matrix'' violates constraint: matrix_height cannot be less than 1')
WHERE (NEW.matrix_height < 1);
END

CREATE TRIGGER 'gpkg_tile_matrix_pixel_x_size_insert'
BEFORE INSERT ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''gpkg_tile_matrix'' violates constraint: pixel_x_size must be greater than 0')
WHERE NOT (NEW.pixel_x_size > 0);
END

CREATE TRIGGER 'gpkg_tile_matrix_pixel_x_size_update'
BEFORE UPDATE OF pixel_x_size ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''gpkg_tile_matrix'' violates constraint: pixel_x_size must be greater than 0')
WHERE NOT (NEW.pixel_x_size > 0);
END

CREATE TRIGGER 'gpkg_tile_matrix_pixel_y_size_insert'
BEFORE INSERT ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''gpkg_tile_matrix'' violates constraint: pixel_y_size must be greater than 0')
WHERE NOT (NEW.pixel_y_size > 0);
END

CREATE TRIGGER 'gpkg_tile_matrix_pixel_y_size_update'
BEFORE UPDATE OF pixel_y_size ON 'gpkg_tile_matrix'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''gpkg_tile_matrix'' violates constraint: pixel_y_size must be greater than 0')
WHERE NOT (NEW.pixel_y_size > 0);
END

D.2. metadata

Table 40. metadata Trigger Definition SQL
CREATE TRIGGER 'gpkg_metadata_md_scope_insert'
BEFORE INSERT ON 'gpkg_metadata'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table gpkg_metadata violates
constraint: md_scope must be one of undefined | fieldSession |
collectionSession | series | dataset | featureType | feature |
attributeType | attribute | tile | model | catalogue | schema |
taxonomy software | service | collectionHardware |
nonGeographicDataset | dimensionGroup')
WHERE NOT(NEW.md_scope IN
('undefined','fieldSession','collectionSession','series','dataset',
'featureType','feature','attributeType','attribute','tile','model',
'catalogue','schema','taxonomy','software','service',
'collectionHardware','nonGeographicDataset','dimensionGroup'));
END

CREATE TRIGGER 'gpkg_metadata_md_scope_update'
BEFORE UPDATE OF 'md_scope' ON 'gpkg_metadata'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table gpkg_metadata violates
constraint: md_scope must be one of undefined | fieldSession |
collectionSession | series | dataset | featureType | feature |
attributeType | attribute | tile | model | catalogue | schema |
taxonomy software | service | collectionHardware |
nonGeographicDataset | dimensionGroup')
WHERE NOT(NEW.md_scope IN
('undefined','fieldSession','collectionSession','series','dataset',
'featureType','feature','attributeType','attribute','tile','model',
'catalogue','schema','taxonomy','software','service',
'collectionHardware','nonGeographicDataset','dimensionGroup'));
END

D.3. metadata_reference

Table 41. gpkg_metadata_reference Trigger Definition SQL
CREATE TRIGGER 'gpkg_metadata_reference_reference_scope_insert'
BEFORE INSERT ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: reference_scope must be one of "geopackage",
table", "column", "row", "row/col"')
WHERE NOT NEW.reference_scope IN
('geopackage','table','column','row','row/col');
END

CREATE TRIGGER 'gpkg_metadata_reference_reference_scope_update'
BEFORE UPDATE OF 'reference_scope' ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: referrence_scope must be one of "geopackage",
"table", "column", "row", "row/col"')
WHERE NOT NEW.reference_scope IN
('geopackage','table','column','row','row/col');
END

CREATE TRIGGER 'gpkg_metadata_reference_column_name_insert'
BEFORE INSERT ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: column name must be NULL when reference_scope
is "geopackage", "table" or "row"')
WHERE (NEW.reference_scope IN ('geopackage','table','row')
AND NEW.column_name IS NOT NULL);
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: column name must be defined for the specified
table when reference_scope is "column" or "row/col"')
WHERE (NEW.reference_scope IN ('column','row/col')
AND NOT NEW.table_name IN (
SELECT name FROM SQLITE_MASTER WHERE type = 'table'
AND name = NEW.table_name
AND sql LIKE ('%' || NEW.column_name || '%')));
END

CREATE TRIGGER 'gpkg_metadata_reference_column_name_update'
BEFORE UPDATE OF column_name ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: column name must be NULL when reference_scope
is "geopackage", "table" or "row"')
WHERE (NEW.reference_scope IN ('geopackage','table','row')
AND NEW.column_nameIS NOT NULL);
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: column name must be defined for the specified
table when reference_scope is "column" or "row/col"')
WHERE (NEW.reference_scope IN ('column','row/col')
AND NOT NEW.table_name IN (
SELECT name FROM SQLITE_MASTER WHERE type = 'table'
AND name = NEW.table_name
AND sql LIKE ('%' || NEW.column_name || '%')));
END

CREATE TRIGGER 'gpkg_metadata_reference_row_id_value_insert'
BEFORE INSERT ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: row_id_value must be NULL when reference_scope
is "geopackage", "table" or "column"')
WHERE NEW.reference_scope IN ('geopackage','table','column')
AND NEW.row_id_value IS NOT NULL;
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: row_id_value must exist in specified table when
reference_scope is "row" or "row/col"')
WHERE NEW.reference_scope IN ('row','row/col')
AND NOT EXISTS (SELECT rowid
FROM (SELECT NEW.table_name AS table_name) WHERE rowid =
NEW.row_id_value);
END

CREATE TRIGGER 'gpkg_metadata_reference_row_id_value_update'
BEFORE UPDATE OF 'row_id_value' ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: row_id_value must be NULL when reference_scope
is "geopackage", "table" or "column"')
WHERE NEW.reference_scope IN ('geopackage','table','column')
AND NEW.row_id_value IS NOT NULL;
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: row_id_value must exist in specified table when
reference_scope is "row" or "row/col"')
WHERE NEW.reference_scope IN ('row','row/col')
AND NOT EXISTS (SELECT rowid
FROM (SELECT NEW.table_name AS table_name) WHERE rowid =
NEW.row_id_value);
END

CREATE TRIGGER 'gpkg_metadata_reference_timestamp_insert'
BEFORE INSERT ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table gpkg_metadata_reference
violates constraint: timestamp must be a valid time in ISO 8601
"yyyy-mm-ddThh-mm-ss.cccZ" form')
WHERE NOT (NEW.timestamp GLOB
'[1-2][0-9][0-9][0-9]-[0-1][0-9]-[1-3][0-9]T[0-2][0-9]:[0-5][0-
9]:[0-5][0-9].[0-9][0-9][0-9]Z'
AND strftime('%s',NEW.timestamp) NOT NULL);
END
CREATE TRIGGER 'gpkg_metadata_reference_timestamp_update'
BEFORE UPDATE OF 'timestamp' ON 'gpkg_metadata_reference'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table gpkg_metadata_reference
violates constraint: timestamp must be a valid time in ISO 8601
"yyyy-mm-ddThh-mm-ss.cccZ" form')
WHERE NOT (NEW.timestamp GLOB
'[1-2][0-9][0-9][0-9]-[0-1][0-9]-[1-3][0-9]T[0-2][0-9]:[0-5][0-
9]:[0-5][0-9].[0-9][0-9][0-9]Z'
AND strftime('%s',NEW.timestamp) NOT NULL);
END

D.4. sample_feature_table

Table 42. EXAMPLE: features table Trigger Definition SQL
CREATE TRIGGER "sample_feature_table_real_insert"
BEFORE INSERT ON "sample_feature_table"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''sample_feature_table''
violates constraint: real_attribute must be greater than 0')
WHERE NOT (NEW.real_attribute > 0);
END

CREATE TRIGGER "sample_feature_table_real_update"
BEFORE UPDATE OF "real_attribute" ON "sample_feature_table"
FOR EACH ROW BEGIN
SELECT RAISE (ABORT, 'update of ''real_attribute'' on table
''sample_feature_table'' violates constraint: real_attribute value
must be > 0')
WHERE NOT (NEW.real_attribute > 0);
END

where <t> and <c> are replaced with the names of the feature table and geometry column being inserted or updated.

D.5. sample_tile_pyramid

Table 43. tiles table Trigger Definition SQL
CREATE TRIGGER "sample_tile_pyramid_zoom_insert"
BEFORE INSERT ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''sample_tile_pyramid'' violates constraint: zoom_level not specified for table in gpkg_tile_matrix')
WHERE NOT (NEW.zoom_level IN (SELECT zoom_level FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid')) ;
END

CREATE TRIGGER "sample_tile_pyramid_zoom_update"
BEFORE UPDATE OF zoom_level ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''sample_tile_pyramid'' violates constraint: zoom_level not specified for table in gpkg_tile_matrix')
WHERE NOT (NEW.zoom_level IN (SELECT zoom_level FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid')) ;
END

CREATE TRIGGER "sample_tile_pyramid_tile_column_insert"
BEFORE INSERT ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''sample_tile_pyramid'' violates constraint: tile_column cannot be < 0')
WHERE (NEW.tile_column < 0) ;
SELECT RAISE(ABORT, 'insert on table ''sample_tile_pyramid'' violates constraint: tile_column must by < matrix_width specified for table and zoom level in gpkg_tile_matrix')
WHERE NOT (NEW.tile_column < (SELECT matrix_width FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid' AND zoom_level = NEW.zoom_level));
END

CREATE TRIGGER "sample_tile_pyramid_tile_column_update"
BEFORE UPDATE OF tile_column ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''sample_tile_pyramid'' violates constraint: tile_column cannot be < 0')
WHERE (NEW.tile_column < 0) ;
SELECT RAISE(ABORT, 'update on table ''sample_tile_pyramid'' violates constraint: tile_column must by < matrix_width specified for table and zoom level in gpkg_tile_matrix')
WHERE NOT (NEW.tile_column < (SELECT matrix_width FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid' AND zoom_level = NEW.zoom_level));
END

CREATE TRIGGER "sample_tile_pyramid_tile_row_insert"
BEFORE INSERT ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'insert on table ''sample_tile_pyramid'' violates constraint: tile_row cannot be < 0')
WHERE (NEW.tile_row < 0) ;
SELECT RAISE(ABORT, 'insert on table ''sample_tile_pyramid'' violates constraint: tile_row must by < matrix_height specified for table and zoom level in gpkg_tile_matrix')
WHERE NOT (NEW.tile_row < (SELECT matrix_height FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid' AND zoom_level = NEW.zoom_level));
END

CREATE TRIGGER "sample_tile_pyramid_tile_row_update"
BEFORE UPDATE OF tile_row ON "sample_tile_pyramid"
FOR EACH ROW BEGIN
SELECT RAISE(ABORT, 'update on table ''sample_tile_pyramid'' violates constraint: tile_row cannot be < 0')
WHERE (NEW.tile_row < 0) ;
SELECT RAISE(ABORT, 'update on table ''sample_tile_pyramid'' violates constraint: tile_row must by < matrix_height specified for table and zoom level in gpkg_tile_matrix')
WHERE NOT (NEW.tile_row < (SELECT matrix_height FROM gpkg_tile_matrix WHERE t_table_name = 'sample_tile_pyramid' AND zoom_level = NEW.zoom_level));
END

Annex E: 几何对象类型 (规范性的)

Table 44. Geometry Type Codes (Core)
Code Name

0

GEOMETRY

1

POINT

2

LINESTRING

3

POLYGON

4

MULTIPOINT

5

MULTILINESTRING

6

MULTIPOLYGON

7

GEOMETRYCOLLECTION

Table 45. Geometry Type Codes (Extension)
Code Name

8

CIRCULARSTRING

9

COMPOUNDCURVE

10

CURVEPOLYGON

11

MULTICURVE

12

MULTISURFACE

13

CURVE

14

SURFACE

GEOMETRY subtypes are POINT, CURVE, SURFACE and GEOMCOLLECTION.

CURVE subtypes are LINESTRING, CIRCULARSTRING and COMPOUNDCURVE.

SURFACE subtype is CURVEPOLYGON.

CURVEPOLYGON subtype is POLYGON.

GEOMETRYCOLLECTION subtypes are MULTIPOINT, MULTICURVE and MULTISURFACE.

MULTICURVE subtype is MULTILINESTRING.

MULTISURFACE subtype is MULTIPOLYGON.

Annex F: 瓦片两倍缩放示例 (资料性的)

Table 46. Zoom Times Two Example
table_name zoom_level matrix_width matrix_height tile_width tile_height pixel_x_size pixel_y_size

MyTiles

0

8

8

512

512

69237.2

68412.1

MyTiles

1

16

16

512

512

34618.6

34206.0

MyTiles

2

32

32

512

512

17309.3

17103.0

MyTiles

3

64

64

512

512

8654.64

8654.64

MyTiles

4

128

128

512

512

4327.32

4275.75

MyTiles

5

256

256

512

512

2163.66

2137.87

MyTiles

6

512

512

512

512

1081.83

1068.93

MyTiles

7

1024

1024

512

512

540.915

543.469

MyTiles

8

2048

2048

512

512

270.457

267.234

Annex G: 分层元数据的示例 (资料性的)

The first example use case is from ISO19115 H.2. Suppose we have this metadata:

CREATE TABLE gpkg_metadata (
  id INTEGER NOT NULL PRIMARY KEY,
  md_scope TEXT NOT NULL DEFAULT 'undefined',
  md_standard_uri TEXT NOT NULL,
  metadata TEXT NOT NULL
)
id md_scope md_standard_uri metadata

0

undefined

http://www.isotc211.org/2005/gmd

TEXT

3

series

http://www.isotc211.org/2005/gmd

TEXT

4

dataset

http://www.isotc211.org/2005/gmd

TEXT

5

featureType

http://www.isotc211.org/2005/gmd

TEXT

6

feature

http://www.isotc211.org/2005/gmd

TEXT

7

attributeType

http://www.isotc211.org/2005/gmd

TEXT

8

attribute

http://www.isotc211.org/2005/gmd

TEXT

and this reference table definition:

CREATE TABLE gpkg_metadata_reference (
  reference_scope TEXT NOT NULL,
  table_name TEXT,
  column_name TEXT,
  row_id_value INTEGER,
  timestamp TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
  md_file_id INTEGER NOT NULL,
  md_parent_id INTEGER,
  CONSTRAINT crmr_mfi_fk FOREIGN KEY (md_file_id) REFERENCES gpkg_metadata(id),
  CONSTRAINT crmr_mpi_fk FOREIGN KEY (md_parent_id) REFERENCES gpkg_metadata(id)
)

H.2 1) Consider a geographic data provider generating vector mapping data for three Administrative areas(A, B and C). … The metadata could be carried exclusively at Dataset Series level.

Then we need a record for each layer table for the three admin areas, like this:

INSERT INTO gpkg_metadata_reference VALUES (
'table', /* reference type */
'roads', /* table name */
'undefined', /* column_name */
-1, /* row_id_value  */
(datetime('now')),
3,  /* md_file_id  */
0  /* md_parent_id  */
)

H.2 2) After some time alternate vector mapping of Administrative area A becomes available. The metadata would then be extended for Administrative area A, to describe the new quality date values. These values would supersede those given for the Dataset series, but only for Administrative area A. The metadata for B and C would remain unchanged. This new metadata would be recorded at Dataset level.

Then we need a record for each layer table in "A" like this:

INSERT INTO gpkg_metadata_reference VALUES (
'table', /* reference type */
'roads', /* table name */
'undefined', /* column_name */
-1, /* row_id_value  */
(datetime('now')),
 4,  /* md_file_id  */
3  /* md_parent_id  */
)

H.2 3) Eventually further data becomes available for Administrative area A, with a complete re-survey of the road network. Again this implies new metadata for the affected feature types. This metadata would be carried at Feature type level for Administrative area A. All other metadata relating to other feature types remains unaffected. Only the metadata for roads in Administrative area A is modified. This road metadata is recorded at Feature type level.

Then we need a record for each layer table for the roads network, like this:

INSERT INTO gpkg_metadata_reference VALUES (
'table', /* reference type */
'roads', /* table name */
'undefined', /* column_name */
-1, /* row_id_value  */
(datetime('now')),
5,  /* md_file_id  */
4  /* md_parent_id  */
)

H.2 4) An anomaly in the road survey is identified, in that all Overhead clearances for the Administrative area A have been surveyed to the nearest metre. These are re-surveyed to the nearest decimetre. This re-survey implies new metadata for the affected attribute type ‘Overhead Clearance’. All other metadata for Administrative area A remains unaffected. This ‘Overhead Clearance’ metadata is recorded at Attribute Type level.

Then we need a record for each layer table in the roads network with attribute type Overhead Clearance, like this;

INSERT INTO gpkg_metadata_reference VALUES (
'column', /* reference type */
'roads', /* table name */
'overhead_clearance', /* column_name */
-1, /* row_id_value  */
(datetime('now')),
7,  /* md_file_id  */
4  /* md_parent_id  */
)

H.2 5) A new bridge is constructed in Administrative area A. This new data is reflected in the geographic data for Administrative area A, and new metadata is required to record this new feature. All other metadata for Administrative area A remains unaffected. This new feature metadata is recorded at Feature instance level.

Then we need a record for the bridge layer table row for the new bridge, like this:

INSERT INTO gpkg_metadata_reference VALUES (
'row', /* reference type */
'bridge', /* table name */
'undefined', /* column_name */
987, /* row_id_value  */
(datetime('now')),
6,  /* md_file_id  */
4  /* md_parent_id  */
)

H.2 6) The overhead clearance attribute of the new bridge was wrongly recorded, and is modified. Again this new attribute requires new metadata to describe the modification. All other metadata for Administrative area A remains unaffected. This new attribute metadata is recorded at Attribute instance level.

Then we need a record for the clearance attribute value, like this:

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'bridge', /* table name */
'overhead_clearance', /* column_name */
987, /* row_id_value  */
(datetime('now')),
8,  /* md_file_id  */
4  /* md_parent_id  */
)

The second example use case is for a field data collection session. This use case demonstrates a mechanism to indicate which data in a GeoPackage that was originally loaded with data from one or more services has been collected or updated since the initial load, and therefore MAY need to be uploaded to update the original services (e.g. WFS, WCS, WMTS).

Suppose a user with a mobile handheld device goes out in the field and collects observations of a new "Point of Interest" (POI) feature type, and associated metadata about the field session, the new feature type, some POI instances and some of their attributes (e.g. spatial accuracy, attribute accuracy) that results in the following additional metadata:

id md_scope md_standard_uri metadata

1

fieldSession

http://schemas.opengis.net/iso/19139/

TEXT

10

featureType

http://schemas.opengis.net/iso/19139/

TEXT

11

feature

http://schemas.opengis.net/iso/19139/

TEXT

12

attribute

http://schemas.opengis.net/iso/19139/

TEXT

13

attribute

http://schemas.opengis.net/iso/19139/

TEXT

14

feature

http://schemas.opengis.net/iso/19139/

TEXT

15

attribute

http://schemas.opengis.net/iso/19139/

TEXT

16

attribute

http://schemas.opengis.net/iso/19139/

TEXT

17

feature

http://schemas.opengis.net/iso/19139/

TEXT

18

attribute

http://schemas.opengis.net/iso/19139/

TEXT

19

attribute

http://schemas.opengis.net/iso/19139/

TEXT

(This example assumes that the field session data is still considered "raw" and won’t be considered a data set or part of a data series until it has been verified and cleaned, but if that is wrong then additional series and data set metadata could be added.)

Then we need a gpkg_metadata_reference record for the field session for the new POI table, whose md_parent_id is undefined:

INSERT INTO gpkg_metadata_reference VALUES (
'table', /* reference type */
'poi', /* table name */
'undefined', /* column_name */
-1, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
1,  /* md_file_id  */
0  /* md_parent_id  */
)

Then we need a gpkg_metadata_reference record for the feature type for the new POI table, whose md_parent_id is that of the field session:

INSERT INTO gpkg_metadata_reference VALUES (
'table', /* reference type */
'poi', /* table name */
'undefined', /* column_name */
-1, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
10,  /* md_file_id  */
1  /* md_parent_id  */
)

Then we need gpkg_metadata_reference records for the poi feature instance rows, whose md_parent_id is that of the field session:

INSERT INTO gpkg_metadata_reference VALUES (
'row', /* reference type */
'poi', /* table name */
'undefined', /* column_name */
1, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
11,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row', /* reference type */
'poi', /* table name */
'undefined', /* column_name */
2, /* row_id_value  */
14,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row', /* reference type */
'poi', /* table name */
'undefined', /* column_name */
3, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
17,  /* md_file_id  */
1  /* md_parent_id  */
)

And finally we need gpkg_metadata_reference records for the poi attribute instance metadata , whose md_parent_id is that of the field session:

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'point', /* column_name */
1, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
12,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'point', /* column_name */
2, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
15,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'point', /* column_name */
3, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
18,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'category', /* column_name */
1, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
13,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'category', /* column_name */
2, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
16,  /* md_file_id  */
1  /* md_parent_id  */
)

INSERT INTO gpkg_metadata_reference VALUES (
'row/col', /* reference type */
'poi', /* table name */
'category', /* column_name */
3, /* row_id_value  */
(strftime(%Y-%m-%dT%H:%M:%fZ,now)),
19,  /* md_file_id  */
1  /* md_parent_id  */
)

As long as all metadata collected in the field session either directly (as above) or indirectly (suppose there were a data set level metadata_reference record intermediary) refers to the field session metadata via md_parent_id values, then this chain of metadata references identifies the newly collected information, as Joan requested, in addition to the metadata.

So here is the data after both examples:

Table 47. xml_metadata
id md_scope md_standard_uri metadata

0

undefined

http://www.isotc211.org/2005/gmd

TEXT

1

fieldSession

http://www.isotc211.org/2005/gmd

TEXT

2

collectionSession

http://www.isotc211.org/2005/gmd

TEXT

3

series

http://www.isotc211.org/2005/gmd

TEXT

4

dataset

http://www.isotc211.org/2005/gmd

TEXT

5

featureType

http://www.isotc211.org/2005/gmd

TEXT

6

feature

http://www.isotc211.org/2005/gmd

TEXT

7

attributeType

http://www.isotc211.org/2005/gmd

TEXT

8

attribute

http://www.isotc211.org/2005/gmd

TEXT

10

featureType

http://www.isotc211.org/2005/gmd

TEXT

11

feature

http://www.isotc211.org/2005/gmd

TEXT

12

attribute

http://www.isotc211.org/2005/gmd

TEXT

13

attribute

http://www.isotc211.org/2005/gmd

TEXT

14

feature

http://www.isotc211.org/2005/gmd

TEXT

15

attribute

http://www.isotc211.org/2005/gmd

TEXT

16

attribute

http://www.isotc211.org/2005/gmd

TEXT

17

feature

http://www.isotc211.org/2005/gmd

TEXT

18

attribute

http://www.isotc211.org/2005/gmd

TEXT

19

attribute

http://www.isotc211.org/2005/gmd

TEXT

Table 48. gpkg_metadata_reference
reference_type table_name column_name row_id_value timestamp md_file_id md_parent_id

table

roads

undefined

0

ts

3

0

table

roads

undefined

0

ts

4

3

table

roads

undefined

0

ts

5

4

column

roads

overhead_clearance

0

ts

7

4

row

bridge

undefined

987

ts

6

4

row/col

bridge

overhead_clearance

987

ts

8

4

table

poi

undefined

0

ts

1

0

row

poi

undefined

0

ts

10

1

row

poi

undefined

1

ts

11

1

row

poi

undefined

2

ts

14

1

row/col

poi

undefined

3

ts

17

1

row/col

poi

point

1

ts

12

1

row/col

poi

point

2

ts

15

1

row/col

poi

point

3

ts

18

1

row/col

poi

category

1

ts

13

1

row/col

poi

category

2

ts

16

1

row/col

poi

category

3

ts

19

1

Annex H: 栅格瓦片元数据的示例 (资料性的)

A number of raster image processing problems MAY require the support of more metadata that is contained in the image itself. Applications MAY use the gpkg_metadata and gpkg_metadata_reference tables defined in clause metadata to store raster image metadata defined according to standard authoritative or application or vendor specific metadata models. An example of the data items in such a model is shown in the following table.

  • Rational Polynomial Coefficient

  • Photometric Interpretation

  • No Data Value

  • Compression Quality Factor

  • Georectification

  • NIIRS

  • Min X

  • Min Y

  • Max X

  • Max Y

Annex I: GeoPackage 扩展的模板 (规范性的)

Extension Title

Title of the Extension

Introduction

Description of extension

Extension Author

Author of extension, author_name.

Extension Name or Template

Name of the extension or definition of the template to create the name of extensions that should be used in gpkg_extensions

Extension Type

"Extension of Existing Requirement in Clause(s) XXX" or "New Requirement Dependent on Clause(s) YYY"

Applicability

Tables and/or columns on which this extension may be applied

Scope

Read-write or write-only with clarification if necessary

Requirements

Definition of extension and interdependencies with other extensions if any.

GeoPackage

Definition of extension data or MIME type(s)

Definition of extension tables or table templates

Definition of triggers or trigger templates

GeoPackage SQLite Configuration

Definition of SQLite configuration settings

Setting compile or runtime Option Shall / Not (Value) Discussion

GeoPackage SQLite Extension

Definition of SQL functions

SQL Function Description Use

foo(bar, baz) : datatype

Returns r when w

Annex J: GeoPackage 几何类型扩展的模板 (规范性的)

Extension Title

GeoPackage Non-Linear Geometry Types

Introduction

Clause 2.1.4 of the GeoPackage Version 1 Encoding Standard specifies support for the Geometry, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeomCollection geometry types in the GeoPackageBinary geometry encoding format specified in clause 2.1.3. This extension specifies support for the additional CircularString, CompoundCurve, CurvePolygon, MultiCurve, MultiSurface, Curve, and Surface geometry types in the GeoPackage Binary geometry encoding format using the codes listed in Annex D.

Extension Author

GeoPackage SWG, author_name gpkg

Extension Name or Template

Extension names are constructed from the gpkg_geom_<gname> template where <gname> is the uppercase name of the extension geometry type in Annex D Table 52?

Extension Type

Extension of Existing Requirement in clause SQL几何类型

Applicability

This extension applies to any column specified in the gpkg_geometry_columns table.

Scope

Read-write

Requirements

GeoPackage

The GeoPackageBinary geometry encoding format specified in clause 几何对象编码 SHALL be used to encode non-linear geometry types using the type codes in 几何对象类型 (规范性的) table Geometry Type Codes (Extension).

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

SQL functions that operate on GeoPackageBinary geometries as specified in other extensions SHALL operate correctly on the non-linear geometries specified in this extension.

Annex K: 用户自定义的几何类型编码扩展的模板 (规范性的)

Extension Title

User Defined Geometry Types Extension of GeoPackageBinary Geometry Encoding

Introduction

This extension specifies a standard way to implement user defined extensions of the GeoPackageBinary geometry encoding format to encode geometry types not specified in clauses SQL几何类型 and 3.1.1 and listed in 几何对象类型 (规范性的). It is intended to be a bridge to enable use of geometry types like EllipiticalCurve in Extended GeoPackages until standard encodings of such types are developed and published for the Well Known Binary (WKB) format.

Extension Author

Name of implementer, author_name NOT gpkg.

Extension Name or Template

Extension names are constructed from the <author_name>_geom_<gname> template where <gname> is the uppercase name of an extension geometry type NOT in 几何对象类型 (规范性的).

Extension Type

Extension of Existing Requirement in clauses 几何对象编码, SQL几何类型 and 3.1.1.

Applicability

This extension applies to any column specified in the gpkg_geometry_columns table.

Scope

Read-write

Requirements

This extension specifies use of an ExtendedGeoPackageBinary encoding format for geometry types not listed in 几何对象类型 (规范性的), and use of the extension name in uppercase for the geometry_type_name column value in the gpkg_geometry_columns table.

GeoPackage

One of the reserved bits in the GeoPackageBinary header is used to indicate the presence of the ExtendedGeopackageBinary encoding format. In the extension case a four byte sequence follows the GPB header to disambiguate various extensions. This extension_code SHOULD identify the implementer of the extension and/or the particular geometry type extension, and SHOULD be unique. The actual extension geometry body is not specified, but SHALL be described in the extension document.

ExtendedGeoPackageBinary {
  GeoPackageBinaryHeader header; (1)
  byte[4] extension_code;        (2)
  byte[] extension_specific;     (3)
}
1 The X bit in the header flags field must be set to 1.
2 To indicate different extensions or vendors. 0x47504B47 (GPKG in ASCII) is reserved.
3 Extension specific contents

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

SQL functions that operate on GeoPackageBinary geometries as specified in other extensions SHALL operate correctly on user-defined geometry types encoded in the ExtendedGeopackageBinary format as specified in this extension.

Annex L: R树空间索引扩展 (规范性的)

Extension Title

Rtree Spatial Indexes

Introduction

The rtree index extension provides a means to encode an rtree index for geometry values in a GeoPackage. An RTree index provides a significant performance advantage for searches with basic envelope spatial criteria that return subsets of the rows in a feature table with a non-trivial number (thousands or more) of rows.

Extension Author

GeoPackage SWG, author_name gpkg.

Extension Name or Template

gpkg_rtree_index

Extension Type

New Requirement dependent on clauses 几何对象编码 and 3.1.2.

Applicability

This extension applies to any column specified in the gpkg_geometry_columns table.

Scope

Write-only, because it does not change the result of reads, although it may improve their performance.

Requirements

This extension uses the rtree implementation provided by the SQLite R*Tree Module extension documented at http://www.sqlite.org/rtree.html.

GeoPackage

The tables below contain SQL templates with variables. Replace the following template variables with the specified values to create the required SQL statements:
<t>: The name of the feature table containing the geometry column
<c>: The name of the geometry column in <t> that is being indexed
<i>: The name of the integer primary key column in <t> as specified in Requirement 29

Create Virtual Table

RTree spatial indexes on geometry columns SHALL be created using the SQLite Virtual Table RTree extension. An application that creates a spatial index SHALL create it using the following SQL statement template:

CREATE VIRTUAL TABLE rtree_<t>_<c> USING rtree(id, minx, maxx, miny, maxy)

where <t> and <c> are replaced with the names of the feature table and geometry column being indexed. The rtree function id parameter becomes the virtual table 64-bit signed integer primary key id column, and the min/max x/y parameters are min- and max-value pairs (stored as 32-bit floating point numbers) for each dimension that become the virtual table data columns that are populated to create the spatial rtree index.

Load Spatial Index Values

The indexes provided by the SQLite Virtual Table RTree extension are not automatic indices. This means the index data structure needs to be manually populated, updated and queried. Each newly created spatial index SHALL be populated using the following SQL statement

INSERT OR REPLACE INTO rtree_<t>_<c>
  SELECT <i>, st_minx(<c>), st_maxx(<c>), st_miny(<c>), st_maxy(<c>) FROM <t>;

where <t> and <c> are replaced with the names of the feature table and geometry column being indexed and <i> is replaced with the name of the feature table integer primary key column.

Define Triggers to Maintain Spatial Index Values

For each spatial index in a GeoPackage, corresponding insert, update and delete triggers that update the spatial index SHALL be present on the indexed geometry column. These spatial index triggers SHALL be defined as follows:

/* Conditions: Insertion of non-empty geometry
   Actions   : Insert record into rtree */
CREATE TRIGGER rtree_<t>_<c>_insert AFTER INSERT ON <t>
  WHEN (new.<c> NOT NULL AND NOT ST_IsEmpty(NEW.<c>))
BEGIN
  INSERT OR REPLACE INTO rtree_<t>_<c> VALUES (
    NEW.<i>,
    ST_MinX(NEW.<c>), ST_MaxX(NEW.<c>),
    ST_MinY(NEW.<c>), ST_MaxY(NEW.<c>)
  );
END;

/* Conditions: Update of geometry column to non-empty geometry
               No row ID change
   Actions   : Update record in rtree */
CREATE TRIGGER rtree_<t>_<c>_update1 AFTER UPDATE OF <c> ON <t>
  WHEN OLD.<i> = NEW.<i> AND
       (NEW.<c> NOTNULL AND NOT ST_IsEmpty(NEW.<c>))
BEGIN
  INSERT OR REPLACE INTO rtree_<t>_<c> VALUES (
    NEW.<i>,
    ST_MinX(NEW.<c>), ST_MaxX(NEW.<c>),
    ST_MinY(NEW.<c>), ST_MaxY(NEW.<c>)
  );
END;

/* Conditions: Update of geometry column to empty geometry
               No row ID change
   Actions   : Remove record from rtree */
CREATE TRIGGER rtree_<t>_<c>_update2 AFTER UPDATE OF <c> ON <t>
  WHEN OLD.<i> = NEW.<i> AND
       (NEW.<c> ISNULL OR ST_IsEmpty(NEW.<c>))
BEGIN
  DELETE FROM rtree_<t>_<c> WHERE id = OLD.<i>;
END;

/* Conditions: Update of any column
               Row ID change
               Non-empty geometry
   Actions   : Remove record from rtree for old <i>
               Insert record into rtree for new <i> */
CREATE TRIGGER rtree_<t>_<c>_update3 AFTER UPDATE OF <c> ON <t>
  WHEN OLD.<i> != NEW.<i> AND
       (NEW.<c> NOTNULL AND NOT ST_IsEmpty(NEW.<c>))
BEGIN
  DELETE FROM rtree_<t>_<c> WHERE id = OLD.<i>;
  INSERT OR REPLACE INTO rtree_<t>_<c> VALUES (
    NEW.<i>,
    ST_MinX(NEW.<c>), ST_MaxX(NEW.<c>),
    ST_MinY(NEW.<c>), ST_MaxY(NEW.<c>)
  );
END;

/* Conditions: Update of any column
               Row ID change
               Empty geometry
   Actions   : Remove record from rtree for old and new <i> */
CREATE TRIGGER rtree_<t>_<c>_update4 AFTER UPDATE ON <t>
  WHEN OLD.<i> != NEW.<i> AND
       (NEW.<c> ISNULL OR ST_IsEmpty(NEW.<c>))
BEGIN
  DELETE FROM rtree_<t>_<c> WHERE id IN (OLD.<i>, NEW.<i>);
END;

/* Conditions: Row deleted
   Actions   : Remove record from rtree for old <i> */
CREATE TRIGGER rtree_<t>_<c>_delete AFTER DELETE ON <t>
  WHEN old.<c> NOT NULL
BEGIN
  DELETE FROM rtree_<t>_<c> WHERE id = OLD.<i>;
END;

where <t> and <c> are replaced with the names of the feature table and geometry column being indexed and <i> is replaced with the name of the feature table integer primary key column.

GeoPackage SQLite Configuration

Definition of SQLite configuration settings

Setting compile or runtime Option Shall / Not (Value) Discussion

compile

SQLITE_ENABLE_RTREE

Shall

RTrees ares used for GeoPackage Spatial Indexes

compile

SQLITE_RTREE_INT_ONLY

Not

RTrees with floating point values are used for GeoPackage spatial indexes

GeoPackage SQLite Extension

Definition of SQL functions

SQL Function Description Use

ST_IsEmpty(geom Geometry): integer

Returns 1 if geometry value is empty, 0 if not empty, NULL if geometry value is NULL

Test if a geometry value corresponds to the empty set

ST_MinX(geom Geometry): real

Returns the minimum X value of the bounding envelope of a geometry

Update the spatial index on a geometry column in a feature table

ST_MaxX(geom Geometry): real

Returns the maximum Y value of the bounding envelope of a geometry

Update the spatial index on a geometry column in a feature table

ST_MinY(geom Geometry): real

Returns the minimum X value of the bounding envelope of a geometry

Update the spatial index on a geometry column in a feature table

ST_MaxY(geom Geometry): real

Returns the maximum Y value of the bounding envelope of a geometry

Update the spatial index on a geometry column in a feature table

The SQL functions on geometries in this SQLite Extension SHALL operate correctly on extended geometry types specified by 用户自定义的几何类型编码扩展的模板 (规范性的) and/or GeoPackage 几何类型扩展的模板 (规范性的) when those extensions are also implemented.

Annex M: 几何类型触发器扩展 (规范性的)

Extension Title

Geometry Type Triggers

Introduction

Geometry type triggers prevent the storage of geometries of types that are not assignable from the geometry types specified in the gpkg_geometry_columns table in the geometry columns of the specified tables.

Extension Author

GeoPackage SWG, author_name gpkg.

Extension Name or Template

gpkg_geometry_type_trigger

Extension Type

New Requirement dependent on clauses 几何对象编码 and 3.1.2.

Applicability

This extension applies to any column specified in the gpkg_geometry_columns table.

Scope

Write-only

Requirements

The <t> and <c> template parameters in the geometry type trigger definition SQL template in the table below are to be replaced with the names of the feature table and geometry column being inserted or updated.

GeoPackage

CREATE TRIGGER fgti_<t>_<c> BEFORE INSERT ON '<t>' FOR EACH ROW
BEGIN
  SELECT RAISE (ABORT, 'insert on <t> violates constraint: ST_GeometryType(<c>) is not assignable from gpkg_geometry_columns.geometry_type_name value')
  WHERE (SELECT geometry_type_name FROM gpkg_geometry_columns
         WHERE Lower(table_name) = Lower('<t>')
                 AND Lower(column_name) = Lower('<c>')
                 AND gpkg_IsAssignable(geometry_type_name, ST_GeometryType(NEW.<c>)) = 0;
END

CREATE TRIGGER fgtu_<t>_<c> BEFORE UPDATE OF '<c>' ON '<t>' FOR EACH ROW
BEGIN
  SELECT RAISE (ABORT, 'update of <c> on <t> violates constraint: ST_GeometryType(<c>) is not assignable from gpkg_geometry_columns.geometry_type_name value')
  WHERE (SELECT geometry_type_name FROM gpkg_geometry_columns
         WHERE Lower(table_name) = Lower('<t>')
                 AND Lower(column_name) = Lower('<c>')
                 AND gpkg_IsAssignable(geometry_type_name, ST_GeometryType(NEW.<c>)) = 0;
END

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

Definition of SQL functions

SQL Function Description Use

ST_GeometryType(geom. Geometry) : TEXT

Returns the WKB geometry type name of a Geometry

Check that the geometry type matches what’s specified in gpkg_geometry_columns.geometry_type_name

GPKG_IsAssignable(expected_type_name TEXT, actual_type_name TEXT): INTEGER

Returns 1 if a value of type expected_type_name is the same or a super type of type actual_type_name. Returns 0 otherwise.

Determine if the expected geometry type is the same as or a super type of the actual geometry type.

The SQL functions on geometries in this SQLite Extension SHALL operate correctly on extended geometry types specified by 用户自定义的几何类型编码扩展的模板 (规范性的) and/or GeoPackage 几何类型扩展的模板 (规范性的) when those extensions are also implemented.

Annex N: 几何对象 SRS ID 触发器扩展 (规范性的)

Extension Title

Geometry SRS_ID Triggers

Introduction

Geometry SRS_ID triggers prevent the storage of geometries with spatial reference system identifiers that are not specified in the gpkg_geometry_columns table in the geometry columns of the specified tables.

Extension Author

GeoPackage SWG, author_name gpkg.

Extension Name or Template

gpkg_srs_id_trigger

Extension Type

New Requirement dependent on clauses 几何对象编码 and 3.1.2.

Applicability

This extension applies to any column specified in the gpkg_geometry_columns table.

Scope

Write-only

Requirements

The <t> and <c> template parameters in the SRS_ID trigger definition SQL template in the table below are to be replaced with the names of the feature table and geometry column being inserted or updated

GeoPackage

CREATE TRIGGER fgsi_<t> _<c> BEFORE INSERT ON '<t>' FOR EACH ROW
BEGIN
  SELECT RAISE (ABORT, 'insert on <t>violates constraint: ST_SRID(<c>) does not match gpkg_geometry_columns.srs_id value')
  WHERE (SELECT srs_id FROM gpkg_geometry_columns
         WHERE Lower(table_name) = Lower('<t>')
               AND   Lower(column_name) = Lower('<c>')
               AND   ST_SRID(NEW.'<c>') <> srs_id) ;
END

CREATE TRIGGER fgsu_<t>_<c> BEFORE UPDATE OF '<c>' ON '<t>' FOR EACH ROW
BEGIN
  SELECT RAISE (ABORT, 'update of <c> on <t> violates constraint: ST_SRID(<c>) does not match gpkg_geometry_columns.srs_id value')
  WHERE (SELECT srs_id FROM gpkg_geometry_columns
         WHERE Lower(table_name) = Lower('<t>')
               AND   Lower(column_name) = Lower('<c>')
               AND   ST_SRID(NEW.'<c>') <> srs_id);
END

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

Definition of SQL functions

SQL Function Description Use

ST_SRID(geom. Geometry) : INTEGER

Returns the spatial reference system id of a Geometry

Check that geometry srid matches what’s specified in gpkg_geometry_columns.srid

The SQL function on geometries in this SQLite Extension SHALL operate correctly on extended geometry types specified by Annex J and/or Annex K when those extensions are also implemented.

Annex O: 其他缩放间隔扩展 (规范性的)

Extension Title

Zoom Other Intervals

Introduction

In a GeoPackage, zoom levels are integers in sequence from 0 to n that identify tile matrix layers in a tile matrix set that contain tiles of decreasing spatial extent and finer spatial resolution. Adjacent zoom levels immediately precede or follow each other and differ by a value of 1. Pixel sizes are real numbers in the terrain units of the spatial reference system of a tile image specifying the dimensions of the real world area represented by one pixel. Pixel sizes MAY vary by a constant factor or by different factors or intervals between some or all adjacent zoom levels in a tile matrix set. In the commonly used "zoom times two" convention, pixel sizes vary by a factor of 2 between all adjacent zoom levels, as shown in the example in 瓦片两倍缩放示例 (资料性的).

This extension enables use of "zoom other intervals" conventions with different factors or irregular intervals with pixel sizes chosen for intuitive cartographic representation of raster data, or to coincide with the original pixel size of commonly used global image products. See WMTS [16] Annex E for additional examples of both conventions.

Extension Author

GeoPackage SWG, author_name gpkg

Extension Name or Template

gpkg_zoom_other

Extension Type

Extension of Existing Requirement in clause 2.2.3.

Applicability

This extension applies to any table listed in the gpkg_contents table with a data_type of tiles.

Scope

Read-write

Requirements

GeoPackage

The pixel_x_size and / or pixel_y_size column values in the gpkg_tile_matrix table vary by irregular intervals or by regular intervals other than a factor of two (the default) between adjacent zoom levels for a particular tile matrix set pyramid table.

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

None

Annex P: WEBP瓦片编码格式扩展 (规范性的)

Extension Title

Tile Encoding WebP

Introduction

PNG and JPEG are the default MIME types for encoding images in tile pyramid user data tables. This extension allows the use of image/x-webp as an additional encoding type.

Extension Author

GeoPackage SWG, author_name gpkg.

Extension Name or Template

gpkg_webp

Extension Type

Extension of Existing Requirement in clauses PNG瓦片编码格式 and JPEG瓦片编码格式.

Applicability

This extension applies to any table listed in the gpkg_contents table with a data_type of tiles.

Scope

Read-write

Requirements

GeoPackage

The MIME type of values of the tile_data column in tile pyramid user data tables SHALL be image/x-webp.

GeoPackage SQLite Configuration

None

GeoPackage SQLite Extension

None

Annex Q: 参考标准 (规范性的)

The following normative documents contain provisions which, through reference in this text, constitute provisions of OGC 12-128. For dated references, subsequent amendments to, or revisions of, any of these publications do not apply. However, parties to agreements based on this part of OGC 12-128 are encouraged to investigate the possibility of applying the most recent editions of the normative documents indicated below. For undated references, the latest edition of the normative document referred to applies.

Annex R: 参考资料 (资料性的)


1. SQLite version 4 (reference B25), which will be an alternative to version 3, not a replacement thereof, was not available when this specification was written. See Future Work clause in Annex B.
2. SQLite is in the public domain (see http://www.sqlite.org/copyright.html)
3. With SQLite versions 3.7.17 and later this value MAY be set with the "PRAGMA application_id=1196437808;" SQL statement, where 1196437808 is the 32-bit integer value of 0x47503130. With earlier versions of SQLite the application id can be set by writing the byte sequence 0x47, 0x50, 0x31, 0x30 at offset 68 in the SQLite database file (see http://www.sqlite.org/fileformat2.html#database_header for details).
4. New applications should use the latest available SQLite version software <<8>>
5. The following statement selects an ISO 8601timestamp value using the SQLite strftime function: SELECT (strftime('%Y-%m-%dT%H:%M:%fZ','now')).
6. OGC WKB simple feature geometry types specified in <<13>> are a subset of the ISO WKB geometry types specified in <<16>>
7. WKB geometry types are are restricted to 0, 1 and 2-dimensional geometric objects that exist in 2, 3 or 4-dimensional coordinate space; they are not geographic or geodesic geometry types.
8. The axis order in WKB is always (x,y{,z}{,m}) where x is easting or longitude, y is northing or latitude, z is optional elevation and m is optional measure.
9. A GeoPackage is not required to contain any feature data tables. Feature data tables in a GeoPackage MAY be empty.
10. GeoPackage applications MAY use SQL triggers or tests in application code to meet this requirement
11. Images of multiple MIME types MAY be stored in given table. For example, in a tiles table, image/png format tiles COULD be used for transparency where there is no data on the tile edges, and image/jpeg format tiles COULD be used for storage efficiency where there is image data for all pixels. Images of multiple bit depths of the same MIME type MAY also be stored in a given table, for example image/png tiles in both 8 and 24 bit depths.
12. See clause 3.2.1.1.1 for use of other zoom levels as a registered extensions.
13. See Clause 3.2.2 regarding use of the WebP alternative tile MIME type as a registered extension.
14. See Clause 3.2.2 regarding use of the WebP alternative tile MIME type as a registered extension.
15. GeoPackage applications MAY query the gpkg_tile_matrix table or the tile pyramid user data table to determine the minimum and maximum zoom levels for a given tile pyramid table.
16. GeoPackage applications MAY query a tile pyramid user data table to determine which tiles are available at each zoom level.
17. GeoPackage applications that insert, update, or delete tile pyramid user data table tiles row records are responsible for maintaining the corresponding descriptive contents of the gpkg_tile_matrix_metadata table.
18. The `gpkg_tile_matrix_set` table contains coordinates that define a bounding box as the exact stated spatial extent for all tiles in a tile (matrix set) table. If the geographic extent of the image data contained in tiles at a particular zoom level is within but not equal to this bounding box, then the non-image area of matrix edge tiles must be padded with no-data values, preferably transparent ones.
19. A GeoPackage is not required to contain any tile pyramid user data tables. Tile pyramid user data tables in a GeoPackage MAY be empty.
20. The zoom_level / tile_column / tile_row unique key is automatically indexed, and allows tiles to be selected and accessed by "z, x, y", a common convention used by some implementations. This table / view definition MAY also allow tiles to be selected based on a spatially indexed bounding box in a separate metadata table.
21. A GeoPackage is not required to contain a gpkg_data_columns table. The gpkg_data_columns table in a GeoPackage MAY be empty.
22. GeoPackages MAY contain MIME types other than the raster image types specified in clauses 2.2.4, 2.2.5, and 3.2.2 as feature attributes, but they are not required to do so.
23. Informative examples of hierarchical metadata are provided in <<metadata_example_appendix>>
24. An informative example of raster image metadata is provided in <<tiles_example_appendix>>
25. 例如, 对于元数据ISO 19139来说,这个URI的指应该是命名空间 http://www.isotc211.org/2005/gmd
26. The scope codes in <<metadata_scopes>> include a very wide set of descriptive information types as “metadata” to describe data.
27. ISO 19139 format metadata (B32) is recommended for general-purpose description of geospatial data at the series and dataset metadata scopes.
28. The “catalog” md_scope MAY be used for Feature Catalog (B40) information stored as XML metadata that is linked to features stored in a GeoPackage.
29. The “schema” md_scope MAY be used for Application Schema (B37)(B38)(B39)(B44) information stored as XML metadata that is linked to features stored in a GeoPackage.
30. The “taxonomy” md_scope MAY be used for taxonomy or knowledge system (B41)(B42) “linked data” information stored as XML metadata that is linked to features stored in a GeoPackage.
31. In SQLite, the rowid value is always equal to the value of a single-column primary key on an integer column [B30\] and is not changed by a database reorganization performed by the VACUUM SQL command.
32. Such a metadata hierarchy MAY have only one level of defined metadata
33. The following statement selects an ISO 8601timestamp value using the SQLite strftime function: SELECT (strftime('%Y-%m-%dT%H:%M:%fZ','now')).
34. See Requirement 82.
35. If an application process will make many updates, it is often faster to drop the indexes, do the updates, and then recreate the indexes.