2018-09-21 06:10:39 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Extract buildings from *.gz to CSV
|
2018-05-30 15:18:37 -04:00
|
|
|
#
|
|
|
|
# Features where::
|
|
|
|
# descriptiveGroup = '(1:Building)'
|
|
|
|
#
|
|
|
|
# Use `fid` as source ID, aka TOID.
|
2018-09-21 06:10:39 -04:00
|
|
|
#
|
2018-05-30 15:18:37 -04:00
|
|
|
|
2018-09-21 06:10:39 -04:00
|
|
|
: ${1?"Usage: $0 ./path/to/data/dir"}
|
2018-05-30 15:18:37 -04:00
|
|
|
|
2018-09-21 06:10:39 -04:00
|
|
|
data_dir=$1
|
2018-05-30 15:18:37 -04:00
|
|
|
|
2018-09-21 06:10:39 -04:00
|
|
|
find $data_dir -type f -name '*.gz' -printf "%f\n" | \
|
2018-05-30 15:18:37 -04:00
|
|
|
parallel \
|
|
|
|
ogr2ogr \
|
2018-09-21 06:10:39 -04:00
|
|
|
-select fid,descriptiveGroup \
|
|
|
|
-f CSV $data_dir/{}.csv \
|
|
|
|
$data_dir/{} \
|
|
|
|
TopographicArea \
|
|
|
|
-lco GEOMETRY=AS_WKT
|
|
|
|
|
|
|
|
# then filter
|
|
|
|
# -where "\"descriptiveGroup='(1:Building)'\"" \
|
|
|
|
# OR toid in addressbase_toids
|
|
|
|
|
|
|
|
# finally load
|
|
|
|
# -t_srs "EPSG:3857" \
|