1
|
# Bash script to dump geoscrub_input table (created by AMK) from the
|
2
|
# vegbien database, and load it into the geoscrub database (i.e., the
|
3
|
# postgis database prepped with geonames.org data, GADM2 data, and
|
4
|
# associated mapping tables).
|
5
|
#
|
6
|
# Won't be necessary if we end up injecting all of the geoscrubbing and
|
7
|
# geovalidation functionality directly into vegbien itself. And if we
|
8
|
# end up implementing this stuff as a standalone service instead, we'd
|
9
|
# need to rethink (and generalize) how the input data is handled. But
|
10
|
# for now, this should at least serve as a placeholder that could be
|
11
|
# tweaked manually to load any arbitrary geoscrub input data table.
|
12
|
#
|
13
|
# Jim Regetz
|
14
|
# NCEAS
|
15
|
# Created Nov 2012
|
16
|
|
17
|
# dump distinct records from vegbien
|
18
|
psql --host vegbiendev -U bien vegbien \
|
19
|
-c 'COPY "public.2012-11-04-07-34-10.r5984".geoscrub_input
|
20
|
TO STDOUT
|
21
|
WITH CSV' > geoscrub-corpus.csv
|
22
|
|
23
|
# generate table
|
24
|
psql -c \
|
25
|
'CREATE TABLE vegbien_geoscrub (
|
26
|
country text,
|
27
|
stateProvince text,
|
28
|
county text,
|
29
|
decimalLatitude double precision,
|
30
|
decimalLongitude double precision
|
31
|
)' geoscrub
|
32
|
|
33
|
# load
|
34
|
psql -c "COPY vegbien_geoscrub FROM '$DATADIR/geoscrub-corpus.csv' WITH CSV" geoscrub
|
35
|
|
36
|
|