Skip to content

Commit

Permalink
Changed the order of loading, streams last to see if aquifers and not…
Browse files Browse the repository at this point in the history
…ations fail first
  • Loading branch information
mpaivinen-bcgov committed Sep 28, 2023
1 parent 46c04f8 commit 0effb5d
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0effb5d

Please sign in to comment.