Feature Style
This extension defines styles and icons for feature geometries. Feature tables may assigned default styles and features may be individually styled. Styles may be assigned as geometry type specific.
This extension depends on the OGC GeoPackage Related Tables Extension.
This extension depends on the NGA Contents Id Extension for default style configurations.
National Geospatial-Intelligence Agency, author_name nga
nga_feature_style
New Requirement
This extension applies to the table names of feature user tables (2.1.6).
Read-write
The Feature Style extension is registered into the gpkg_extensions
table once per feature table.
Each user-defined mapping table between a feature or table and a style or icon is registered per the Related Tables Extension.
<feature_table_name>
= name of a feature table
table_name | column_name | extension_name | definition | scope |
---|---|---|---|---|
|
null |
|
URL to this extension description |
read-write |
|
null |
|
http://www.geopackage.org/18-000.html |
read-write |
|
null |
|
http://www.geopackage.org/18-000.html |
read-write |
|
null |
|
http://www.geopackage.org/18-000.html |
read-write |
|
null |
|
http://www.geopackage.org/18-000.html |
read-write |
The Feature Style extension nga_style
and nga_icon
tables are listed as attribute contents tables alongside feature tables.
table_name | data_type | identifier | description | last_change | min_x | min_y | max_x | max_y | srs_id |
---|---|---|---|---|---|---|---|---|---|
|
features |
any |
any |
any |
any |
any |
any |
any |
any |
|
attributes |
any |
any |
any |
null |
null |
null |
null |
null |
|
attributes |
any |
any |
any |
null |
null |
null |
null |
null |
The Style Table defines a geometry style and is an Attributes Table.
Column Name | Type | Description | Null | Default | Key |
---|---|---|---|---|---|
|
INTEGER |
Autoincrement primary key |
no |
PK |
|
|
TEXT |
Feature Style name |
yes |
||
|
TEXT |
Feature Style description |
yes |
||
|
TEXT |
Geometry color in hex format |
yes |
||
|
REAL |
Geometry color opacity inclusively between 0.0 and 1.0, when null assume 1.0 |
yes |
||
|
REAL |
Geometry line stroke or point width >= 0.0, when null assume 1.0 |
yes |
||
|
TEXT |
Closed geometry fill color in hex format |
yes |
||
|
REAL |
Closed geometry fill color opacity inclusively between 0.0 and 1.0, when null assume 1.0 |
yes |
CREATE TABLE nga_style (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name TEXT,
description TEXT,
color TEXT,
opacity REAL,
width REAL,
fill_color TEXT,
fill_opacity REAL
);
The Icon Table defines a geometry icon or marker and is a Related Tables Extension Media Table.
Column Name | Type | Description | Null | Default | Key |
---|---|---|---|---|---|
|
INTEGER |
Autoincrement primary key |
no |
PK |
|
|
BLOB |
Feature Icon content |
no |
||
|
TEXT |
Mime-type of the feature icon |
no |
||
|
TEXT |
Feature Icon name |
yes |
||
|
TEXT |
Feature Icon description |
yes |
||
|
REAL |
Icon display width. When null and height has value, maintain aspect ratio. When null and height is null, use data icon width. |
yes |
||
|
REAL |
Icon display height. When null and width has value, maintain aspect ratio. When null and width is null, use data icon height. |
yes |
||
|
REAL |
UV Mapping horizontal anchor distance inclusively between 0.0 and 1.0 from the left edge, when null assume 0.5 (middle of icon) |
yes |
||
|
REAL |
UV Mapping vertical anchor distance inclusively between 0.0 and 1.0 from the top edge, when null assume 1.0 (bottom of icon) |
yes |
CREATE TABLE nga_icon (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
data BLOB NOT NULL,
content_type TEXT NOT NULL,
name TEXT,
description TEXT,
width REAL,
height REAL,
anchor_u REAL,
anchor_v REAL
);
The Contents Id Extension is used to relate default styles to a feature table by an INTEGER
primary key, as required by the Related Tables Extension User-Defined Mapping Tables.
id | table_name |
---|---|
any |
|
Related Tables Extension Mapping Tables are used to relate:
nga_style_default_<feature_table_name>
nga_icon_default_<feature_table_name>
nga_style_<feature_table_name>
nga_icon_<feature_table_name>
The Mapping Tables are defined in the Related Tables Extension Relations Table:
id | base_table_name | base_primary_column | related_table_name | related_primary_column | relation_name | mapping_table_name |
---|---|---|---|---|---|---|
any |
|
|
|
|
attributes |
|
any |
|
|
|
|
media |
|
any |
|
|
|
|
attributes |
|
any |
|
|
|
|
media |
|
Style and Icon Mapping Tables contain the id mapping columns and a nullable geometry_type_name.
Column Name | Type | Description | Null | Default | Key |
---|---|---|---|---|---|
|
INTEGER |
The primary key value of the base data table ( |
no |
||
|
INTEGER |
The primary key value of the related data table ( |
no |
||
|
TEXT |
Name from Geometry Type Codes (Core) or Geometry Type Codes (Extension) in Geometry Types (Normative) A null value configures a top level or default geometry style or icon. A defined geometry type maps the style or icon for geometries of that and inherited geometry types. The lowest configured feature matching geometry type takes priority. User-Defined Mapping Table unique constraints are discouraged, but duplicate |
yes |
CREATE TABLE nga_[style_default|icon_default|style|icon]_<feature_table_name> (
base_id INTEGER NOT NULL,
related_id INTEGER NOT NULL,
geometry_type_name TEXT
);
None
None
The rivers GeoPackage has a default style for the rivers
feature table.
The example GeoPackage has styles and icons for the geometry1
and geometry2
feature tables.