2018-10-04 13:59:53 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Load boundary and filter geometries
|
|
|
|
# - boundary MUST be epsg:3857
|
|
|
|
# use: ogr2ogr -t_srs EPSG:3857 boundary.3857.shp boundary.shp
|
|
|
|
#
|
|
|
|
: ${1?"Usage: $0 ./path/to/boundary"}
|
|
|
|
boundary_file=$1
|
|
|
|
|
2022-04-21 09:14:46 -04:00
|
|
|
echo "Load boundary..."
|
2018-10-04 13:59:53 -04:00
|
|
|
psql -c "DROP TABLE IF EXISTS boundary"
|
|
|
|
shp2pgsql -s 3857 $boundary_file boundary | psql
|
|
|
|
|
2022-04-21 09:14:46 -04:00
|
|
|
echo "Delete geometries (hence buildings, building_properties)..."
|
2018-10-04 13:59:53 -04:00
|
|
|
psql -c "DELETE FROM geometries as g
|
|
|
|
USING boundary as b
|
|
|
|
WHERE b.gid = 1 AND NOT ST_ContainsProperly(b.geom, g.geometry_geom);"
|