1.. _vector.geopackage_aspatial:
2
3GeoPackage aspatial extension
4=============================
5
6GeoPackage 1.0 Extension
7
8Extension follows template from Annex I of the OGC `GeoPackage 1.0 Specification`_.
9
10Extension Title
11---------------
12
13Aspatial Support
14
15Introduction
16^^^^^^^^^^^^
17
18Support for aspatial data (i.e. SQLite tables/views without a geometry column),
19potentially with associated metadata.
20
21This was used in GDAL 2.0 and GDAL 2.1, before the introduction of the
22'attributes' data_type of GeoPackage v1.2. Starting with GDAL 2.2, 'attributes'
23will be used by default, so this extension is now legacy.
24
25Extension Author
26^^^^^^^^^^^^^^^^
27
28`GDAL - Geospatial Data Abstraction Library`_, author_name `gdal`.
29
30Extension Name or Template
31^^^^^^^^^^^^^^^^^^^^^^^^^^
32
33SQL
34
35.. code-block::
36
37    INSERT INTO gpkg_extensions
38    (table_name, column_name, extension_name, definition, scope)
39    VALUES
40    (
41        NULL,
42        NULL,
43        'gdal_aspatial',
44        'http://gdal.org/geopackage_aspatial.html',
45        'read-write'
46    );
47
48Extension Type
49^^^^^^^^^^^^^^
50
51Extension of Existing Requirement in Clause 2.
52
53Applicability
54^^^^^^^^^^^^^
55
56This extension applies to any aspatial user data table or view specified in the
57``gpkg_contents`` table with a lowercase `data_type` column value of "aspatial".
58
59Scope
60^^^^^
61
62Read-write
63
64Requirements
65^^^^^^^^^^^^
66
67GeoPackage
68""""""""""
69
70Contents Table - Aspatial
71
72The `gpkg_contents` table SHALL contain a row with a lowercase `data_type`
73column value of "aspatial" for each aspatial user data table or view.
74
75User Data Tables
76
77The second component of the SQL schema for aspatial tables in an Extended
78GeoPackage described in clause 'Contents Table - Aspatial' above are user
79tables or views that contain aspatial user data.
80
81An Extended GeoPackage with aspatial support is not required to contain any
82user data tables. User data tables MAY be empty.
83
84An Extended GeoPackage with aspatial support MAY contain tables or views. Every
85such aspatial table or view MAY have a column with column type INTEGER and
86PRIMARY KEY AUTOINCREMENT column constraints per EXAMPLE.
87
88
89.. list-table::
90   :header-rows: 1
91
92   * - Column Name
93     - Type
94     - Description
95     - Null
96     - Default
97     - Key
98   * - `id`
99     - INTEGER
100     - Autoincrement primary key
101     - no
102     -
103     - PK
104   * - `text_attribute`
105     - TEXT
106     - Text attribute of row
107     - yes
108     -
109     -
110   * - `real_attribute`
111     - REAL
112     - Real attribute of row
113     - yes
114     -
115     -
116   * - `boolean_attribute`
117     - BOOLEAN
118     - Boolean attribute of row
119     - yes
120     -
121     -
122   * - `raster_or_photo`
123     - BLOB
124     - Photograph
125     - yes
126     -
127     -
128
129An integer primary key of an aspatial table or view allows features to be
130linked to row level metadata records in the `gpkg_metadata` table by
131`SQLite ROWID`_ values in the `gpkg_metadata_reference` table as described
132in clause 2.4.3 Metadata Reference Table.
133
134An aspatial table or view SHALL NOT have a geometry column.
135
136Columns in aspatial tables or views SHALL be defined using only the data types
137specified in Table 1 in Clause 1.1.1.1.3.
138
139GeoPackage SQLite Configuration
140"""""""""""""""""""""""""""""""
141
142None
143
144GeoPackage SQLite Extension
145"""""""""""""""""""""""""""
146
147None
148
149.. _`GeoPackage 1.0 Specification`: http://www.geopackage.org/
150.. _`GDAL - Geospatial Data Abstraction Library`: http://gdal.org
151.. _`SQLite ROWID`: http://www.sqlite.org/lang_createtable.html#rowid
152