19 lines
506 B
Bash
19 lines
506 B
Bash
|
#!/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
|
||
|
|
||
|
# Load boundary
|
||
|
psql -c "DROP TABLE IF EXISTS boundary"
|
||
|
shp2pgsql -s 3857 $boundary_file boundary | psql
|
||
|
|
||
|
# Delete geometries (hence buildings, building_properties)
|
||
|
psql -c "DELETE FROM geometries as g
|
||
|
USING boundary as b
|
||
|
WHERE b.gid = 1 AND NOT ST_ContainsProperly(b.geom, g.geometry_geom);"
|