From 0effb5d7fc1b34fc5102aa2b69d452403cb25101 Mon Sep 17 00:00:00 2001 From: mpaivinen-bcgov <108498730+mpaivinen-bcgov@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:23:06 -0700 Subject: [PATCH] Changed the order of loading, streams last to see if aquifers and notations fail first --- Makefile | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index f965285..eb1c0ce 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ ALL_TARGETS = data/fwa.gpkg \ .make/db \ - .make/fwa_stream_networks_sp \ .make/gw_aquifers_classification_svw \ .make/notations_src \ + .make/fwa_stream_networks_sp \ .make/fwa_fixdata \ .make/fwa_functions @@ -45,59 +45,57 @@ clean_db: $(PSQL_CMD) -c "CREATE SCHEMA IF NOT EXISTS postgisftw" # for fwapg featureserv functions touch $@ -# streams: for faster load of large table: -# - load to temp table -# - add measure to geom when copying data to output table -# - create indexes after load -.make/fwa_stream_networks_sp: .make/db data/fwa.gpkg - $(PSQL_CMD) -c "drop table if exists whse_basemapping.fwa_stream_networks_sp_load" +.make/gw_aquifers_classification_svw: .make/db data/fwa.gpkg + $(PSQL_CMD) -c "drop table if exists whse_water_management.GW_AQUIFERS_CLASSIFICATION_SVW" ogr2ogr \ -f PostgreSQL \ PG:$(DATABASE_URL_OGR) \ - -nlt LINESTRING \ - -nln whse_basemapping.fwa_stream_networks_sp_load \ + -nlt POLYGON \ + -nln whse_water_management.GW_AQUIFERS_CLASSIFICATION_SVW \ -lco GEOMETRY_NAME=geom \ -lco OVERWRITE=YES \ -dim XYZ \ -lco SPATIAL_INDEX=NONE \ -preserve_fid \ data/fwa.gpkg \ - FWA_STREAM_NETWORKS_SP - $(PSQL_CMD) -f sql/tables/source/fwa_stream_networks_sp.sql + GW_AQUIFERS_CLASSIFICATION_SVW touch $@ -.make/gw_aquifers_classification_svw: .make/db data/fwa.gpkg - $(PSQL_CMD) -c "drop table if exists whse_water_management.GW_AQUIFERS_CLASSIFICATION_SVW" +.make/notations_src: .make/db data/fwa.gpkg + $(PSQL_CMD) -c "drop table if exists nr_water_notations.notations_src" ogr2ogr \ -f PostgreSQL \ PG:$(DATABASE_URL_OGR) \ - -nlt POLYGON \ - -nln GW_AQUIFERS_CLASSIFICATION_SVW \ - -lco SCHEMA=whse_water_management + -nlt POINT \ + -nln nr_water_notations.notations_src \ -lco GEOMETRY_NAME=geom \ -lco OVERWRITE=YES \ -dim XYZ \ -lco SPATIAL_INDEX=NONE \ -preserve_fid \ data/fwa.gpkg \ - GW_AQUIFERS_CLASSIFICATION_SVW + WLS_WATER_NOTATION_SV touch $@ -.make/notations_src: .make/db data/fwa.gpkg - $(PSQL_CMD) -c "drop table if exists nr_water_notations.notations_src" +# streams: for faster load of large table: +# - load to temp table +# - add measure to geom when copying data to output table +# - create indexes after load +.make/fwa_stream_networks_sp: .make/db data/fwa.gpkg + $(PSQL_CMD) -c "drop table if exists whse_basemapping.fwa_stream_networks_sp_load" ogr2ogr \ -f PostgreSQL \ PG:$(DATABASE_URL_OGR) \ - -nlt POINT \ - -nln notations_src \ + -nlt LINESTRING \ + -nln whse_basemapping.fwa_stream_networks_sp_load \ -lco GEOMETRY_NAME=geom \ -lco OVERWRITE=YES \ - -lco SCHEMA=nr_water_notations \ -dim XYZ \ -lco SPATIAL_INDEX=NONE \ -preserve_fid \ data/fwa.gpkg \ - WLS_WATER_NOTATION_SV + FWA_STREAM_NETWORKS_SP + $(PSQL_CMD) -f sql/tables/source/fwa_stream_networks_sp.sql touch $@ # apply fixes