Revision 11560
Added by Paul Sarando about 11 years ago
derived/biengeo/update_validation_data.sh | ||
---|---|---|
23 | 23 |
echo "-d, --dbname=DBNAME database name psql commands will connect to" >&2 |
24 | 24 |
echo "-h, --host=HOSTNAME database server host or socket directory" >&2 |
25 | 25 |
echo "-U, --username=USERNAME database user name" >&2 |
26 |
echo "Update Options:" >&2 |
|
27 |
echo "-G, --gadm-only update only GADM data" >&2 |
|
28 |
echo "-N, --geonames-only update only geonames.org data" >&2 |
|
29 |
echo "-M, --geonames-to-gadm-only update niether GADM nor geonames.org data," >&2 |
|
30 |
echo " but geonames-to-gadm mappings are always updated." >&2 |
|
26 | 31 |
exit 1; |
27 | 32 |
} |
28 | 33 |
|
... | ... | |
67 | 72 |
DB_NAME="${1#*=}" |
68 | 73 |
shift |
69 | 74 |
;; |
75 |
-G | --gadm-only) |
|
76 |
NO_GEONAMES=TRUE |
|
77 |
shift |
|
78 |
;; |
|
79 |
-N | --geonames-only) |
|
80 |
NO_GADM=TRUE |
|
81 |
shift |
|
82 |
;; |
|
83 |
-M | --geonames-to-gadm-only) |
|
84 |
NO_GADM=TRUE |
|
85 |
NO_GEONAMES=TRUE |
|
86 |
shift |
|
87 |
;; |
|
70 | 88 |
*) |
71 | 89 |
echo "Invalid option: $1" >&2 |
72 | 90 |
usage |
... | ... | |
86 | 104 |
|
87 | 105 |
echo "Updating geoscrub validation data." |
88 | 106 |
|
89 |
"${SCRIPT_DIR}"/update_gadm_data.sh -U "$DB_USER" $DB_HOST_OPT -d "$DB_NAME" |
|
90 |
if [[ $? != 0 ]]; then |
|
91 |
echo "Could not update ${DB_NAME} database with GADM data." |
|
92 |
exit 1 |
|
107 |
if [[ -z $NO_GADM ]]; then |
|
108 |
"${SCRIPT_DIR}"/update_gadm_data.sh -U "$DB_USER" $DB_HOST_OPT -d "$DB_NAME" |
|
109 |
if [[ $? != 0 ]]; then |
|
110 |
echo "Could not update ${DB_NAME} database with GADM data." |
|
111 |
exit 1 |
|
112 |
fi |
|
93 | 113 |
fi |
94 | 114 |
|
95 |
"${SCRIPT_DIR}"/update_geonames_data.sh -U "$DB_USER" $DB_HOST_OPT -d "$DB_NAME" |
|
96 |
if [[ $? != 0 ]]; then |
|
97 |
echo "Could not update ${DB_NAME} database with geonames.org data." |
|
98 |
exit 1 |
|
115 |
if [[ -z $NO_GEONAMES ]]; then |
|
116 |
"${SCRIPT_DIR}"/update_geonames_data.sh -U "$DB_USER" $DB_HOST_OPT -d "$DB_NAME" |
|
117 |
if [[ $? != 0 ]]; then |
|
118 |
echo "Could not update ${DB_NAME} database with geonames.org data." |
|
119 |
exit 1 |
|
120 |
fi |
|
99 | 121 |
fi |
100 | 122 |
|
101 | 123 |
run_sql_script "${SCRIPT_DIR}/geonames-to-gadm.country.sql" |
Also available in: Unified diff
Added update options to biengeo update_validation_data.sh
Added options to update only GADM data, only Geonames.org data, or
neither. In every case, the geonames-to-gadm scripts are always run.