Skip to content

Commit

Permalink
Updated column types of TOP10NL schema
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteggink committed Mar 7, 2018
1 parent 2b42f6c commit 6d69030
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 42 deletions.
2 changes: 1 addition & 1 deletion top10nl/etl/conf/etl-top10nl-v1.2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ file_path = sql/drop-tables-v1.2.sql,sql/create-schema.sql
# Post SQL file inputs to be executed
[input_sql_post]
class = inputs.fileinput.StringFileInput
file_path = sql/update-multiattributes-v1.2.sql,sql/update-geoms-v1.2.sql
file_path = sql/create-final-tables-v1.2.sql,sql/update-multiattributes-v1.2.sql

# Generic filter to substitute Python-format string values like {schema} in string
[schema_name_filter]
Expand Down
26 changes: 13 additions & 13 deletions top10nl/etl/gfs/top10-v1.2.gfs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<GMLFeatureClassList>
<!--Dit GFS-bestand is gegenereerd met make-gfs.xsl-->
<GMLFeatureClass>
<Name>FunctioneelGebied</Name>
<Name>FunctioneelGebied_tmp</Name>
<ElementPath>FunctioneelGebied</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -128,7 +128,7 @@
<!--Einde properties van FunctioneelGebied-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Gebouw</Name>
<Name>Gebouw_tmp</Name>
<ElementPath>Gebouw</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -277,7 +277,7 @@
<!--Einde properties van Gebouw-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>GeografischGebied</Name>
<Name>GeografischGebied_tmp</Name>
<ElementPath>GeografischGebied</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -398,7 +398,7 @@
<!--Einde properties van GeografischGebied-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Hoogte</Name>
<Name>Hoogte_tmp</Name>
<ElementPath>Hoogte</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_lijn</Name>
Expand Down Expand Up @@ -515,7 +515,7 @@
<!--Einde properties van Hoogte-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Inrichtingselement</Name>
<Name>Inrichtingselement_tmp</Name>
<ElementPath>Inrichtingselement</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_lijn</Name>
Expand Down Expand Up @@ -652,7 +652,7 @@
<!--Einde properties van Inrichtingselement-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Plaats</Name>
<Name>Plaats_tmp</Name>
<ElementPath>Plaats</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -798,7 +798,7 @@
<!--Einde properties van Plaats-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>PlanTopografie</Name>
<Name>PlanTopografie_tmp</Name>
<ElementPath>PlanTopografie</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -915,7 +915,7 @@
<!--Einde properties van PlanTopografie-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>RegistratiefGebied</Name>
<Name>RegistratiefGebied_tmp</Name>
<ElementPath>RegistratiefGebied</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -1042,7 +1042,7 @@
<!--Einde properties van RegistratiefGebied-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Relief</Name>
<Name>Relief_tmp</Name>
<ElementPath>Relief</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_lijn</Name>
Expand Down Expand Up @@ -1170,7 +1170,7 @@
<!--Einde properties van Relief-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Spoorbaandeel</Name>
<Name>Spoorbaandeel_tmp</Name>
<ElementPath>Spoorbaandeel</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_lijn</Name>
Expand Down Expand Up @@ -1340,7 +1340,7 @@
<!--Einde properties van Spoorbaandeel-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Terrein</Name>
<Name>Terrein_tmp</Name>
<ElementPath>Terrein</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -1462,7 +1462,7 @@
<!--Einde properties van Terrein-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Waterdeel</Name>
<Name>Waterdeel_tmp</Name>
<ElementPath>Waterdeel</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down Expand Up @@ -1653,7 +1653,7 @@
<!--Einde properties van Waterdeel-->
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Wegdeel</Name>
<Name>Wegdeel_tmp</Name>
<ElementPath>Wegdeel</ElementPath>
<GeomPropertyDefn>
<Name>geometrie_vlak</Name>
Expand Down
26 changes: 13 additions & 13 deletions top10nl/etl/meta/top10-v1.2-gfs-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>FunctioneelGebied</Name>
<Name>FunctioneelGebied_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>FunctioneelGebied</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -133,7 +133,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Gebouw</Name>
<Name>Gebouw_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Gebouw</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -197,7 +197,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>GeografischGebied</Name>
<Name>GeografischGebied_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>GeografischGebied</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -233,7 +233,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Hoogte</Name>
<Name>Hoogte_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Hoogte</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -265,7 +265,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Inrichtingselement</Name>
<Name>Inrichtingselement_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Inrichtingselement</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -317,7 +317,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Plaats</Name>
<Name>Plaats_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Plaats</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -378,7 +378,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>PlanTopografie</Name>
<Name>PlanTopografie_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>PlanTopografie</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -410,7 +410,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>RegistratiefGebied</Name>
<Name>RegistratiefGebied_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>RegistratiefGebied</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -452,7 +452,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Relief</Name>
<Name>Relief_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Relief</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -494,7 +494,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Spoorbaandeel</Name>
<Name>Spoorbaandeel_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Spoorbaandeel</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -579,7 +579,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Terrein</Name>
<Name>Terrein_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Terrein</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -616,7 +616,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Waterdeel</Name>
<Name>Waterdeel_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Waterdeel</ElementPath>
<GeomPropertyDefn>
Expand Down Expand Up @@ -722,7 +722,7 @@
</PropertyDefn>
</GMLFeatureClass>
<GMLFeatureClass>
<Name>Wegdeel</Name>
<Name>Wegdeel_tmp</Name>
<ParentClass>Top10Object</ParentClass>
<ElementPath>Wegdeel</ElementPath>
<GeomPropertyDefn>
Expand Down
135 changes: 135 additions & 0 deletions top10nl/etl/sql/create-final-tables-v1.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
-- Create final tables in TOP10NL schema

-- Functioneel gebied
create table functioneelgebied as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typefunctioneelgebied, soortnaam, naamnl, naamfries, case when geometrie_vlak is not null then st_multi(geometrie_vlak)::geometry(MULTIPOLYGON, 28992) else geometrie_multivlak end geometrie_multivlak, geometrie_punt from functioneelgebied_tmp;

alter table functioneelgebied add primary key (ogc_fid);
alter table functioneelgebied alter column gml_id set not null;
create index functioneelgebied_geometrie_multivlak_geom_idx on functioneelgebied using gist((geometrie_multivlak::geometry(MULTIPOLYGON, 28992)));
create index functioneelgebied_geometrie_punt_geom_idx on functioneelgebied using gist((geometrie_punt::geometry(POINT, 28992)));

drop table functioneelgebied_tmp;

-- Gebouw
create table gebouw as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typegebouw, fysiekvoorkomen, hoogteklasse, hoogteniveau, hoogte, status, soortnaam, naam, gebruiksdoel, geometrie_vlak, geometrie_punt from gebouw_tmp;

alter table gebouw add primary key (ogc_fid);
alter table gebouw alter column gml_id set not null;
create index gebouw_geometrie_vlak_geom_idx on gebouw using gist((geometrie_vlak::geometry(POLYGON, 28992)));
create index gebouw_geometrie_punt_geom_idx on gebouw using gist((geometrie_punt::geometry(POINT, 28992)));

drop table gebouw_tmp;

-- Geografisch gebied
create table geografischgebied as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typegeografischgebied, naamnl, naamfries, case when geometrie_vlak is not null then st_multi(geometrie_vlak)::geometry(MULTIPOLYGON, 28992) else geometrie_multivlak end geometrie_multivlak, geometrie_punt from geografischgebied_tmp;

alter table geografischgebied add primary key (ogc_fid);
alter table geografischgebied alter column gml_id set not null;
create index geografischgebied_geometrie_multivlak_geom_idx on geografischgebied using gist((geometrie_multivlak::geometry(MULTIPOLYGON, 28992)));
create index geografischgebied_geometrie_punt_geom_idx on geografischgebied using gist((geometrie_punt::geometry(POINT, 28992)));

drop table geografischgebied_tmp;

-- Hoogte
create table hoogte as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typehoogte, hoogte, referentievlak, geometrie_lijn, geometrie_punt from hoogte_tmp;

alter table hoogte add primary key (ogc_fid);
alter table hoogte alter column gml_id set not null;
create index hoogte_geometrie_lijn_geom_idx on hoogte using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index hoogte_geometrie_punt_geom_idx on hoogte using gist((geometrie_punt::geometry(POINT, 28992)));

drop table hoogte_tmp;

-- Inrichtingselement
create table inrichtingselement as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typeinrichtingselement, hoogte, breedte, hoogteniveau, soortnaam, naam, nummer, geometrie_lijn, geometrie_punt from inrichtingselement_tmp;

alter table inrichtingselement add primary key (ogc_fid);
alter table inrichtingselement alter column gml_id set not null;
create index inrichtingselement_geometrie_lijn_geom_idx on inrichtingselement using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index inrichtingselement_geometrie_punt_geom_idx on inrichtingselement using gist((geometrie_punt::geometry(POINT, 28992)));

drop table inrichtingselement_tmp;

-- Plaats
create table plaats as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typegebied, bebouwdekom, isbagwoonplaats, aantalinwoners, naamofficieel, naamnl, naamfries, case when geometrie_vlak is not null then st_multi(geometrie_vlak)::geometry(MULTIPOLYGON, 28992) else geometrie_multivlak end geometrie_multivlak, geometrie_punt from plaats_tmp;

alter table plaats add primary key (ogc_fid);
alter table plaats alter column gml_id set not null;
create index plaats_geometrie_multivlak_geom_idx on plaats using gist((geometrie_multivlak::geometry(MULTIPOLYGON, 28992)));
create index plaats_geometrie_punt_geom_idx on plaats using gist((geometrie_punt::geometry(POINT, 28992)));

drop table plaats_tmp;

-- Plantopografie
create table plantopografie as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typeobject, naam, geometrie_vlak, geometrie_lijn, geometrie_punt from plantopografie_tmp;

alter table plantopografie add primary key (ogc_fid);
alter table plantopografie alter column gml_id set not null;
create index plantopografie_geometrie_vlak_geom_idx on plantopografie using gist((geometrie_vlak::geometry(POLYGON, 28992)));
create index plantopografie_geometrie_lijn_geom_idx on plantopografie using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index plantopografie_geometrie_punt_geom_idx on plantopografie using gist((geometrie_punt::geometry(POINT, 28992)));

drop table plantopografie_tmp;

-- Registratief gebied
create table registratiefgebied as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typeregistratiefgebied, naamofficieel, naamnl, naamfries, nummer, case when geometrie_vlak is not null then st_multi(geometrie_vlak)::geometry(MULTIPOLYGON, 28992) else geometrie_multivlak end geometrie_multivlak from registratiefgebied_tmp;

alter table registratiefgebied add primary key (ogc_fid);
alter table registratiefgebied alter column gml_id set not null;
create index registratiefgebied_geometrie_multivlak_geom_idx on registratiefgebied using gist((geometrie_multivlak::geometry(MULTIPOLYGON, 28992)));

drop table registratiefgebied_tmp;

-- Relief
create table relief as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typerelief, hoogteklasse, hoogteniveau, functie, geometrie_lijn, geometrie_hogezijde, geometrie_lagezijde from relief_tmp;

alter table relief add primary key (ogc_fid);
alter table relief alter column gml_id set not null;
create index relief_geometrie_lijn_geom_idx on relief using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index relief_geometrie_hogezijde_geom_idx on relief using gist((geometrie_hogezijde::geometry(LINESTRING, 28992)));
create index relief_geometrie_lagezijde_geom_idx on relief using gist((geometrie_lagezijde::geometry(LINESTRING, 28992)));

drop table relief_tmp;

-- Spoorbaandeel
create table spoorbaandeel as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typeinfrastructuur, typespoorbaan, fysiekvoorkomen, spoorbreedte, aantalsporen, vervoerfunctie, elektrificatie, hoogteniveau, status, brugnaam, tunnelnaam, baanvaknaam, geometrie_lijn, geometrie_punt from spoorbaandeel_tmp;

alter table spoorbaandeel add primary key (ogc_fid);
alter table spoorbaandeel alter column gml_id set not null;
create index spoorbaandeel_geometrie_lijn_geom_idx on spoorbaandeel using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index spoorbaandeel_geometrie_punt_geom_idx on spoorbaandeel using gist((geometrie_punt::geometry(POINT, 28992)));

drop table spoorbaandeel_tmp;

-- Terrein
create table terrein as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typelandgebruik, fysiekvoorkomen, voorkomen, hoogteniveau, naam, wkb_geometry geometrie_vlak from terrein_tmp;

alter table terrein add primary key (ogc_fid);
alter table terrein alter column gml_id set not null;
create index terrein_geometrie_vlak_geom_idx on terrein using gist((geometrie_vlak::geometry(POLYGON, 28992)));

drop table terrein_tmp;

-- Waterdeel
create table waterdeel as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typewater, breedteklasse, hoofdafwatering, fysiekvoorkomen, voorkomen, hoogteniveau, functie, getijdeinvloed, vaarwegklasse, naamofficieel, naamnl, naamfries, isbagnaam, sluisnaam, brugnaam, geometrie_vlak, geometrie_lijn, geometrie_punt from waterdeel_tmp;

alter table waterdeel add primary key (ogc_fid);
alter table waterdeel alter column gml_id set not null;
create index waterdeel_geometrie_vlak_geom_idx on waterdeel using gist((geometrie_vlak::geometry(POLYGON, 28992)));
create index waterdeel_geometrie_lijn_geom_idx on waterdeel using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index waterdeel_geometrie_punt_geom_idx on waterdeel using gist((geometrie_punt::geometry(POINT, 28992)));

drop table waterdeel_tmp;

-- Wegdeel
create table wegdeel as select ogc_fid, gml_id, namespace, lokaalid, brontype, bronactualiteit::date, bronbeschrijving, bronnauwkeurigheid, objectbegintijd::date, objecteindtijd::date, tijdstipregistratie::date, eindregistratie::date, tdncode, visualisatiecode, mutatietype, typeinfrastructuur, typeweg, hoofdverkeersgebruik, fysiekvoorkomen, verhardingsbreedteklasse, gescheidenrijbaan, verhardingstype, aantalrijstroken, hoogteniveau, status, naam, isbagnaam, awegnummer, nwegnummer, ewegnummer, swegnummer, afritnummer, afritnaam, knooppuntnaam, brugnaam, tunnelnaam, geometrie_vlak, geometrie_lijn, geometrie_punt, geometrie_hartpunt, geometrie_hartlijn from wegdeel_tmp;

alter table wegdeel add primary key (ogc_fid);
alter table wegdeel alter column gml_id set not null;
create index wegdeel_geometrie_vlak_geom_idx on wegdeel using gist((geometrie_vlak::geometry(POLYGON, 28992)));
create index wegdeel_geometrie_lijn_geom_idx on wegdeel using gist((geometrie_lijn::geometry(LINESTRING, 28992)));
create index wegdeel_geometrie_punt_geom_idx on wegdeel using gist((geometrie_punt::geometry(POINT, 28992)));
create index wegdeel_geometrie_hartlijn_geom_idx on wegdeel using gist((geometrie_hartlijn::geometry(LINESTRING, 28992)));
create index wegdeel_geometrie_hartpunt_geom_idx on wegdeel using gist((geometrie_hartpunt::geometry(POINT, 28992)));

drop table wegdeel_tmp;

0 comments on commit 6d69030

Please sign in to comment.