From eaa32133e3f28026ca0a56e53f95decf15bf0a51 Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@fripost.org>
Date: Sat, 19 Oct 2024 20:54:07 +0200
Subject: Add layer with noteworthy dams.

Unfortunately the dam register is way too noisy Unfortunately it looks
like there is no way to download a pre-curated dam registry with only
noteworthy dams used for production (SvK's dammar_pf.shp comes close but
still misses some), so we manually remove the ones which are more than
2km from a production site or a power station.
---
 schema.sql | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 7208a34..edae7b7 100644
--- a/schema.sql
+++ b/schema.sql
@@ -73,6 +73,78 @@ SET default_tablespace = '';
 
 SET default_table_access_method = heap;
 
+--
+-- Name: dammar; Type: TABLE; Schema: postgis; Owner: webmap_import
+--
+
+CREATE TABLE postgis.dammar (
+    ogc_fid bigint NOT NULL,
+    "DammID" uuid NOT NULL,
+    "LST_OBJID" character varying(32),
+    "Datum" date NOT NULL,
+    "DNamn" character varying(64),
+    "Status" smallint NOT NULL,
+    "Regleringstyp" smallint NOT NULL,
+    "Konstruktion" smallint NOT NULL,
+    "ByggAr" smallint,
+    "DammHojd" real,
+    "KronLangd" real,
+    "Fiskvag" smallint NOT NULL,
+    "FiskvagByggAr" smallint,
+    "Fiskavledare" smallint,
+    "Vandringshinder" boolean NOT NULL,
+    "HARO" integer NOT NULL,
+    "Vattendistrikt" character varying(10) NOT NULL,
+    inrapp_lst character varying(32) NOT NULL,
+    eu_cd character varying(32),
+    vf_typ character varying(1),
+    vy_eucd character varying(32),
+    vy_vf_typ character varying(1),
+    "DammanlID" character varying(64),
+    "Namn" character varying(64),
+    "Verksamhet" smallint,
+    "OmbyggAr" smallint,
+    "DG" real,
+    "SG" real,
+    "HojdSys" smallint,
+    "MY" double precision,
+    "RV" double precision,
+    "Kommentar" character varying(254),
+    "XX_Distance" double precision,
+    wkb_geometry postgis.geometry(Point,3006)
+);
+
+
+ALTER TABLE postgis.dammar OWNER TO webmap_import;
+
+--
+-- Name: TABLE dammar; Type: COMMENT; Schema: postgis; Owner: webmap_import
+--
+
+COMMENT ON TABLE postgis.dammar IS 'Dammar';
+
+
+--
+-- Name: dammar_ogc_fid_seq; Type: SEQUENCE; Schema: postgis; Owner: webmap_import
+--
+
+CREATE SEQUENCE postgis.dammar_ogc_fid_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+ALTER TABLE postgis.dammar_ogc_fid_seq OWNER TO webmap_import;
+
+--
+-- Name: dammar_ogc_fid_seq; Type: SEQUENCE OWNED BY; Schema: postgis; Owner: webmap_import
+--
+
+ALTER SEQUENCE postgis.dammar_ogc_fid_seq OWNED BY postgis.dammar.ogc_fid;
+
+
 --
 -- Name: gigafactories; Type: TABLE; Schema: postgis; Owner: webmap_import
 --
@@ -2683,6 +2755,13 @@ ALTER TABLE postgis."vbk:vindkraftverk_ogc_fid_seq" OWNER TO webmap_import;
 ALTER SEQUENCE postgis."vbk:vindkraftverk_ogc_fid_seq" OWNED BY postgis."vbk:vindkraftverk".ogc_fid;
 
 
+--
+-- Name: dammar ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
+--
+
+ALTER TABLE ONLY postgis.dammar ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis.dammar_ogc_fid_seq'::regclass);
+
+
 --
 -- Name: gigafactories ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
 --
@@ -3047,6 +3126,22 @@ ALTER TABLE ONLY postgis."vbk:projekteringsomraden" ALTER COLUMN ogc_fid SET DEF
 ALTER TABLE ONLY postgis."vbk:vindkraftverk" ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis."vbk:vindkraftverk_ogc_fid_seq"'::regclass);
 
 
+--
+-- Name: dammar dammar_DammID_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
+--
+
+ALTER TABLE ONLY postgis.dammar
+    ADD CONSTRAINT "dammar_DammID_key" UNIQUE ("DammID");
+
+
+--
+-- Name: dammar dammar_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
+--
+
+ALTER TABLE ONLY postgis.dammar
+    ADD CONSTRAINT dammar_pkey PRIMARY KEY (ogc_fid);
+
+
 --
 -- Name: gigafactories gigafactories_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
 --
@@ -3927,6 +4022,13 @@ ALTER TABLE ONLY postgis."vbk:vindkraftverk"
     ADD CONSTRAINT "vbk:vindkraftverk_pkey" PRIMARY KEY (ogc_fid);
 
 
+--
+-- Name: dammar_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
+--
+
+CREATE INDEX dammar_wkb_geometry_geom_idx ON postgis.dammar USING gist (wkb_geometry);
+
+
 --
 -- Name: gigafactories_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
 --
@@ -4307,6 +4409,20 @@ GRANT USAGE ON SCHEMA postgis TO webmap_import;
 GRANT USAGE ON SCHEMA postgis TO webmap_guest;
 
 
+--
+-- Name: TABLE dammar; Type: ACL; Schema: postgis; Owner: webmap_import
+--
+
+GRANT SELECT ON TABLE postgis.dammar TO webmap_guest;
+
+
+--
+-- Name: SEQUENCE dammar_ogc_fid_seq; Type: ACL; Schema: postgis; Owner: webmap_import
+--
+
+GRANT SELECT,USAGE ON SEQUENCE postgis.dammar_ogc_fid_seq TO webmap_guest;
+
+
 --
 -- Name: TABLE geography_columns; Type: ACL; Schema: postgis; Owner: postgres
 --
-- 
cgit v1.2.3

