Last active
February 27, 2019 13:23
-
-
Save jlstanus/f18c0d82636a63718af5cbb5869342b2 to your computer and use it in GitHub Desktop.
Exemple of Geopackage creation with SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE 'new_alert_zone_layer' ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
geometry MULTIPOLYGON NOT NULL, | |
LayerNameFr TEXT DEFAULT 'New Layer', | |
LayerNameNl TEXT DEFAULT 'New Layer', | |
NameNl TEXT NOT NULL, | |
NameFr TEXT NOT NULL, | |
Category TEXT NOT NULL DEFAULT 'INFO', | |
Buffer INTEGER NOT NULL DEFAULT 0, | |
'From' TEXT NOT NULL, | |
'To' TEXT NOT NULL, | |
YnAvisFromGv TEXT DEFAULT 'N', | |
YnGvMail TEXT DEFAULT 'N', | |
YnAvisFromZp TEXT DEFAULT 'N', | |
YnZpMail TEXT DEFAULT 'N', | |
Creation TEXT DEFAULT 'N', | |
Validation TEXT DEFAULT 'N', | |
Enreg TEXT DEFAULT 'N', | |
Program TEXT DEFAULT 'N', | |
Degrad TEXT DEFAULT 'N', | |
Ghost TEXT DEFAULT 'N', | |
Edlin TEXT DEFAULT 'N', | |
Callcoord TEXT DEFAULT 'N', | |
Edlout TEXT DEFAULT 'N', | |
DemandAutor TEXT DEFAULT 'N', | |
InCcc TEXT DEFAULT 'N', | |
Autorisation TEXT DEFAULT 'N', | |
Avidem TEXT DEFAULT 'N', | |
Validdemarr TEXT DEFAULT 'N', | |
InviteEdl TEXT DEFAULT 'N', | |
Cloture TEXT DEFAULT 'N', | |
Private TEXT DEFAULT 'N', | |
ImpactWs TEXT DEFAULT 'N', | |
ImpactEvt TEXT DEFAULT 'N' | |
); | |
insert into gpkg_contents values ( | |
'delihn_lines_za', | |
'features', | |
'sample_attribute_with_geometry', | |
'some description', | |
'2019-02-19T10:49:06.022Z', | |
119177.97191802252200432, | |
151376.18710888610803522, | |
181765.27198060075170361, | |
186456.68710888610803522, | |
31370 | |
); | |
insert into gpkg_geometry_columns values ( | |
'delihn_lines_za', | |
'geometry', | |
'MULTIPOLYGON', | |
'31370', | |
'0', | |
'0' | |
); | |
-- Feed with values from other table with different column names | |
insert into | |
new_alert_zone_layer | |
select | |
l.fid as id, | |
l.geom as geometry, | |
'delijn_lines' as LayerNameFr, | |
'delijn_lines' as LayerNameNl, | |
l.name_nl as NameNl, | |
l.name_nl as NameFr, | |
'INFO' as Category, | |
0 as Buffer, | |
'27/02/19' as 'From', | |
'27/02/20' as 'To', | |
'N' as YnAvisFromGv, | |
'N' as YnGvMail, | |
'N' as YnAvisFromZp, | |
'N' as YnZpMail, | |
'N' as Creation, | |
'N' as Validation, | |
'N' as Enreg, | |
'N' as Program, | |
'N' as Degrad, | |
'N' as Ghost, | |
'N' as Edlin, | |
'N' as Callcoord, | |
'N' as Edlout, | |
'N' as DemandAutor, | |
'N' as InCcc, | |
'N' as Autorisation, | |
'N' as Avidem, | |
'N' as Validdemarr, | |
'N' as InviteEdl, | |
'N' as Cloture, | |
'N' as Private, | |
'N' as ImpactWs, | |
'N' as ImpactEvt, | |
l.line_nr as Comment | |
from other_table_source as l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment