Skip to content
Open
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ lib/data/spatial/forest_types_gl
lib/data/spatial/forest_types_ju
lib/data/spatial/forest_types_lu
lib/data/spatial/forest_types_ne
lib/data/spatial/forest_types_sz
lib/data/spatial/forest_types_sg
lib/data/spatial/forest_types_sh
lib/data/spatial/forest_types_so
Expand Down
2 changes: 1 addition & 1 deletion lib/data/spatial/1-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ _import "Download manually" "forest_types_gl" "forest_types_gl" "forest_types_gl

_import "Download manually" "forest_types_ar" "forest_types_ar" "forest_types_ar"

# _import "Download manually" "forest_types_sz" "forest_types_sz" "forest_types_sz"
_import "Download manually" "forest_types_sz" "forest_types_sz" "forest_types_sz"


end=`date +%s`
Expand Down
11 changes: 11 additions & 0 deletions lib/data/sql/export_spatial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ WITH altitudinal_zones_cantonal AS
FROM forest_types_sz
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_fr
WHERE hs_code IS NOT NULL and geom is not null
GROUP BY hs_code, hsue_code)
)foo )

SELECT (code::TEXT || subcode::TEXT)::text AS code, (code::TEXT || subcode::TEXT)::text AS code_style,
Expand Down
64 changes: 18 additions & 46 deletions lib/data/sql/import_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1247,49 +1247,19 @@ SELECT
);
----------------------------------------------
-- Forest types FR
CREATE TABLE "forest_types_fr" (
gid serial,
"objectid" float8,
"legende" varchar(10),
"wg_1" varchar(10),
"ueh_hoch_1" varchar(10),
"ueh_tief_1" varchar(10),
"td_1" varchar(20),
"taux_1" numeric,
"wg_2" varchar(10),
"ueh_hoch_2" varchar(10),
"ueh_tief_2" varchar(10),
"td_2" varchar(20),
"taux_2" numeric,
"wg_3" varchar(10),
"ueh_hoch_3" varchar(10),
"ueh_tief_3" varchar(10),
"td_3" varchar(20),
"taux_3" numeric,
"wgr" varchar(20),
"annee" varchar(2),
"lot" varchar(10),
"etat" float8,
"assoc_tot_" varchar(35),
"pdf" varchar(20),
"pdf_fr" varchar(50),
"pdf_de" varchar(50),
"wg_tot" varchar(50),
"id_legende" int4,
"legende_fr" varchar(150),
"legende_de" varchar(150),
"legende_la" varchar(150),
"fertilite_" float8,
"fertilite1" float8,
"prop_feuil" float8,
"prop_feu_1" float8,
"ass_remarq" varchar(100),
"score_ass_" numeric,
"shape_star" numeric,
"shape_stle" numeric,
"namensuber" varchar(254),
"nais" varchar(10)
);
CREATE TABLE "forest_types_fr" (gid serial,
"fid" numeric,
"assoc_tot_" varchar(254),
"nais" varchar(254),
"nais1" varchar(254),
"nais2" varchar(254),
"mo" numeric,
"ue" numeric,
"tahs" varchar(254),
"tahsue" varchar(254),
"hs_code" float8,
"hsue_code" float8);

ALTER TABLE
"forest_types_fr"
ADD
Expand Down Expand Up @@ -1375,7 +1345,8 @@ SELECT
----------------------------------------------
-- Forest types SZ
CREATE TABLE "forest_types_sz" (
"fid" serial,
gid serial,
"fid" numeric,
"sz_einheit" varchar(80),
"nais" varchar(80),
"nais1" varchar(80),
Expand All @@ -1384,8 +1355,9 @@ CREATE TABLE "forest_types_sz" (
"ue" numeric,
"tahs" varchar(80),
"tahsue" varchar(80),
"hs_code" numeric,
"hsue_code" integer
"grundlage" varchar(254),
"hs_code" float8,
"hsue_code" float8
);
ALTER TABLE
"forest_types_sz"
Expand Down