Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/data/sql/export_spatial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ WITH altitudinal_zones_cantonal AS
WHERE hs_code IS NOT NULL and geom is not null
GROUP BY hs_code, hsue_code)
UNION
(SELECT
ST_Union(geom) AS geom,
CASE hsue_code is null
WHEN TRUE THEN hs_code::text
ELSE hs_code::text || '(' || hsue_code::text || ')'
END AS code,
hs_code::text as code_style
FROM forest_types_tg
WHERE hs_code IS NOT NULL and geom is not null
GROUP BY hs_code, hsue_code)
UNION
(SELECT
ST_Union(geom) AS geom,
CASE hsue_code is null
Expand Down
21 changes: 20 additions & 1 deletion lib/data/sql/import_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,27 @@ SELECT
CREATE TABLE "forest_types_tg" (
gid serial,
"fid" numeric,
"OBJECTID_1" numeric,
"objectid" numeric,
"reviernr" numeric,
"standortei" numeric,
"befahrbark" numeric,
"text" varchar(254),
"laubholzan" numeric,
"g1" numeric,
"g2" numeric,
"typ" numeric,
"ndhant" numeric,
"ndh_2050" numeric,
"zusatz" varchar(254),
"wuechsigk" numeric,
"Shape_Area" numeric,
"tgneu" varchar(50),
"nais" varchar(50)
"nais" varchar(50),
"Hoehenstufe" varchar(50),
"tahsue" varchar(50),
"hs_code" int4,
"hsue_code" int4
);
ALTER TABLE
"forest_types_tg"
Expand Down