|
@@ -17,12 +17,12 @@ DROP TABLE IF EXISTS bagactueel.temp_verblijfsobject_oppervlakte;
|
|
|
DROP MATERIALIZED VIEW IF EXISTS bagactueel.pand_adres;
|
|
|
DROP MATERIALIZED VIEW IF EXISTS bagactueel.wp_gem_prov;
|
|
|
|
|
|
-UPDATE bagactueel.pand
|
|
|
-SET bouwjaar = NULL
|
|
|
+UPDATE bagactueel.pand
|
|
|
+SET bouwjaar = NULL
|
|
|
WHERE bouwjaar > 2050;
|
|
|
|
|
|
-UPDATE bagactueel.verblijfsobject
|
|
|
-SET oppervlakteverblijfsobject = NULL
|
|
|
+UPDATE bagactueel.verblijfsobject
|
|
|
+SET oppervlakteverblijfsobject = NULL
|
|
|
WHERE oppervlakteverblijfsobject IN (1, 9999, 99999, 999999);
|
|
|
|
|
|
/* Maak nieuwe tabel aan voor complete verblijfsobjecten */
|
|
@@ -50,21 +50,21 @@ CREATE UNIQUE INDEX bagactueel_identificatie ON bagactueel.verblijfsobject_compl
|
|
|
|
|
|
/* Voeg de verschillende VO tabellen en de adres-tabel samen */
|
|
|
INSERT INTO bagactueel.verblijfsobject_compleet (
|
|
|
- identificatie,
|
|
|
- verblijfsobjectstatus,
|
|
|
- oppervlakteverblijfsobject,
|
|
|
- gebruiksdoelverblijfsobject,
|
|
|
- gerelateerdpand,
|
|
|
- geopunt,
|
|
|
- openbareruimtenaam,
|
|
|
- huisnummer,
|
|
|
- huisletter,
|
|
|
- huisnummertoevoeging,
|
|
|
+ identificatie,
|
|
|
+ verblijfsobjectstatus,
|
|
|
+ oppervlakteverblijfsobject,
|
|
|
+ gebruiksdoelverblijfsobject,
|
|
|
+ gerelateerdpand,
|
|
|
+ geopunt,
|
|
|
+ openbareruimtenaam,
|
|
|
+ huisnummer,
|
|
|
+ huisletter,
|
|
|
+ huisnummertoevoeging,
|
|
|
postcode,
|
|
|
woonplaatsnaam,
|
|
|
gemeentenaam,
|
|
|
provincienaam
|
|
|
-) SELECT
|
|
|
+) SELECT
|
|
|
VO.identificatie,
|
|
|
VO.verblijfsobjectstatus,
|
|
|
VO.oppervlakteverblijfsobject,
|
|
@@ -96,6 +96,7 @@ CREATE INDEX verblijfsobject_gebruiksdoel ON bagactueel.verblijfsobject_compleet
|
|
|
CREATE INDEX verblijfsobject_woonplaats ON bagactueel.verblijfsobject_compleet (woonplaatsnaam);
|
|
|
CREATE INDEX verblijfsobject_gemeente ON bagactueel.verblijfsobject_compleet (gemeentenaam);
|
|
|
CREATE INDEX verblijfsobject_provincie ON bagactueel.verblijfsobject_compleet (provincienaam);
|
|
|
+CREATE INDEX verblijfsobject_geopunt ON bagactueel.verblijfsobject_compleet USING GIST(geovlak);
|
|
|
|
|
|
/* In een paar stappen gaan we de oppervlaktes afleiden voor de panden */
|
|
|
CREATE TABLE bagactueel.temp_verblijfsobject_oppervlakte(
|
|
@@ -168,7 +169,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'woonfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_bijeenkomstfunctie,
|
|
@@ -183,7 +184,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'bijeenkomstfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_celfunctie,
|
|
@@ -198,7 +199,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'celfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_gezondheidszorgfunctie,
|
|
@@ -213,7 +214,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'gezondheidszorgfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_industriefunctie,
|
|
@@ -228,7 +229,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'industriefunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_kantoorfunctie,
|
|
@@ -243,7 +244,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'kantoorfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_logiesfunctie,
|
|
@@ -258,7 +259,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'logiesfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_onderwijsfunctie,
|
|
@@ -273,7 +274,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'onderwijsfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_sportfunctie,
|
|
@@ -288,7 +289,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'sportfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_winkelfunctie,
|
|
@@ -303,7 +304,7 @@ WHERE
|
|
|
gebruiksdoelverblijfsobject = 'winkelfunctie'
|
|
|
GROUP BY
|
|
|
gerelateerdpand;
|
|
|
-
|
|
|
+
|
|
|
INSERT INTO bagactueel.pand_oppervlakte(
|
|
|
identificatie,
|
|
|
oppervlakte_overige,
|
|
@@ -385,7 +386,7 @@ CREATE TABLE bagactueel.pand_compleet(
|
|
|
woonplaatsnaam varchar(80),
|
|
|
provincienaam varchar(16),
|
|
|
adres TEXT,
|
|
|
-
|
|
|
+
|
|
|
OTO_oppervlakte_totaal numeric(6,0),
|
|
|
OWO_oppervlakte_woonfunctie numeric(6,0),
|
|
|
OBI_oppervlakte_bijeenkomstfunctie numeric(6,0),
|
|
@@ -398,7 +399,7 @@ CREATE TABLE bagactueel.pand_compleet(
|
|
|
OSP_oppervlakte_sportfunctie numeric(6,0),
|
|
|
OWI_oppervlakte_winkelfunctie numeric(6,0),
|
|
|
OOV_oppervlakte_overige numeric(6,0),
|
|
|
-
|
|
|
+
|
|
|
ATO_aantal_totaal numeric(6,0),
|
|
|
AWO_aantal_woonfunctie numeric(6,0),
|
|
|
ABI_aantal_bijeenkomstfunctie numeric(6,0),
|
|
@@ -411,7 +412,7 @@ CREATE TABLE bagactueel.pand_compleet(
|
|
|
ASP_aantal_sportfunctie numeric(6,0),
|
|
|
AWI_aantal_winkelfunctie numeric(6,0),
|
|
|
AOV_aantal_overige numeric(6,0),
|
|
|
-
|
|
|
+
|
|
|
HFO_hoofdfunctie_naar_oppervlakte varchar(30),
|
|
|
HFA_hoofdfunctie_naar_aantal varchar(30)
|
|
|
);
|
|
@@ -425,7 +426,7 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
woonplaatsnaam,
|
|
|
provincienaam,
|
|
|
adres,
|
|
|
-
|
|
|
+
|
|
|
OTO_oppervlakte_totaal,
|
|
|
OWO_oppervlakte_woonfunctie,
|
|
|
OBI_oppervlakte_bijeenkomstfunctie,
|
|
@@ -438,7 +439,7 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
OSP_oppervlakte_sportfunctie,
|
|
|
OWI_oppervlakte_winkelfunctie,
|
|
|
OOV_oppervlakte_overige,
|
|
|
-
|
|
|
+
|
|
|
ATO_aantal_totaal,
|
|
|
AWO_aantal_woonfunctie,
|
|
|
ABI_aantal_bijeenkomstfunctie,
|
|
@@ -451,21 +452,21 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
ASP_aantal_sportfunctie,
|
|
|
AWI_aantal_winkelfunctie,
|
|
|
AOV_aantal_overige,
|
|
|
-
|
|
|
+
|
|
|
HFO_hoofdfunctie_naar_oppervlakte,
|
|
|
HFA_hoofdfunctie_naar_aantal
|
|
|
-
|
|
|
-) SELECT
|
|
|
+
|
|
|
+) SELECT
|
|
|
P.identificatie,
|
|
|
P.pandstatus,
|
|
|
P.bouwjaar,
|
|
|
P.geovlak,
|
|
|
-
|
|
|
+
|
|
|
A.gemeentenaam,
|
|
|
A.woonplaatsnaam,
|
|
|
A.provincienaam,
|
|
|
A.adres,
|
|
|
-
|
|
|
+
|
|
|
oppervlakte_totaal,
|
|
|
oppervlakte_woonfunctie,
|
|
|
oppervlakte_bijeenkomstfunctie,
|
|
@@ -478,7 +479,7 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
oppervlakte_sportfunctie,
|
|
|
oppervlakte_winkelfunctie,
|
|
|
oppervlakte_overige,
|
|
|
-
|
|
|
+
|
|
|
aantal_totaal,
|
|
|
aantal_woonfunctie,
|
|
|
aantal_bijeenkomstfunctie,
|
|
@@ -491,7 +492,7 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
aantal_sportfunctie,
|
|
|
aantal_winkelfunctie,
|
|
|
aantal_overige,
|
|
|
-
|
|
|
+
|
|
|
CASE WHEN GREATEST(oppervlakte_woonfunctie, oppervlakte_bijeenkomstfunctie, oppervlakte_celfunctie, oppervlakte_gezondheidszorgfunctie, oppervlakte_industriefunctie, oppervlakte_kantoorfunctie, oppervlakte_logiesfunctie, oppervlakte_onderwijsfunctie, oppervlakte_sportfunctie, oppervlakte_winkelfunctie, oppervlakte_overige) = oppervlakte_woonfunctie THEN 'woonfunctie'
|
|
|
WHEN GREATEST(oppervlakte_woonfunctie, oppervlakte_bijeenkomstfunctie, oppervlakte_celfunctie, oppervlakte_gezondheidszorgfunctie, oppervlakte_industriefunctie, oppervlakte_kantoorfunctie, oppervlakte_logiesfunctie, oppervlakte_onderwijsfunctie, oppervlakte_sportfunctie, oppervlakte_winkelfunctie, oppervlakte_overige) = oppervlakte_bijeenkomstfunctie THEN 'bijeenkomstfunctie'
|
|
|
WHEN GREATEST(oppervlakte_woonfunctie, oppervlakte_bijeenkomstfunctie, oppervlakte_celfunctie, oppervlakte_gezondheidszorgfunctie, oppervlakte_industriefunctie, oppervlakte_kantoorfunctie, oppervlakte_logiesfunctie, oppervlakte_onderwijsfunctie, oppervlakte_sportfunctie, oppervlakte_winkelfunctie, oppervlakte_overige) = oppervlakte_celfunctie THEN 'celfunctie'
|
|
@@ -505,7 +506,7 @@ INSERT INTO bagactueel.pand_compleet(
|
|
|
WHEN GREATEST(oppervlakte_woonfunctie, oppervlakte_bijeenkomstfunctie, oppervlakte_celfunctie, oppervlakte_gezondheidszorgfunctie, oppervlakte_industriefunctie, oppervlakte_kantoorfunctie, oppervlakte_logiesfunctie, oppervlakte_onderwijsfunctie, oppervlakte_sportfunctie, oppervlakte_winkelfunctie, oppervlakte_overige) = oppervlakte_overige THEN 'overige gebruiksfunctie'
|
|
|
ELSE NULL
|
|
|
END,
|
|
|
-
|
|
|
+
|
|
|
CASE WHEN GREATEST(aantal_woonfunctie, aantal_bijeenkomstfunctie, aantal_celfunctie, aantal_gezondheidszorgfunctie, aantal_industriefunctie, aantal_kantoorfunctie, aantal_logiesfunctie, aantal_onderwijsfunctie, aantal_sportfunctie, aantal_winkelfunctie, aantal_overige) = aantal_woonfunctie THEN 'woonfunctie'
|
|
|
WHEN GREATEST(aantal_woonfunctie, aantal_bijeenkomstfunctie, aantal_celfunctie, aantal_gezondheidszorgfunctie, aantal_industriefunctie, aantal_kantoorfunctie, aantal_logiesfunctie, aantal_onderwijsfunctie, aantal_sportfunctie, aantal_winkelfunctie, aantal_overige) = aantal_bijeenkomstfunctie THEN 'bijeenkomstfunctie'
|
|
|
WHEN GREATEST(aantal_woonfunctie, aantal_bijeenkomstfunctie, aantal_celfunctie, aantal_gezondheidszorgfunctie, aantal_industriefunctie, aantal_kantoorfunctie, aantal_logiesfunctie, aantal_onderwijsfunctie, aantal_sportfunctie, aantal_winkelfunctie, aantal_overige) = aantal_celfunctie THEN 'celfunctie'
|
|
@@ -547,10 +548,10 @@ bagactueel.gemeente_woonplaatsactueelbestaand.woonplaatscode = bagactueel.woonpl
|
|
|
|
|
|
CREATE INDEX wp_gem_prov_geovlak ON bagactueel.wp_gem_prov USING GIST(geovlak);
|
|
|
|
|
|
-/* Voeg woonplaats, gemeente en provincie toe aan alle ongelabelde panden */
|
|
|
+/* Voeg woonplaats, gemeente en provincie toe aan alle ~3908287 ongelabelde panden */
|
|
|
|
|
|
UPDATE bagactueel.pand_compleet P
|
|
|
-SET woonplaatsnaam = WGP.woonplaatsnaam,
|
|
|
+SET woonplaatsnaam = WGP.woonplaatsnaam,
|
|
|
gemeentenaam = WGP.gemeentenaam,
|
|
|
provincienaam = WGP.provincienaam
|
|
|
FROM bagactueel.wp_gem_prov WGP
|