colouring-montreal/etl/update_building_records.sh

24 lines
984 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-04-08 07:17:53 -04:00
## Prerequisites:
## - Make geometries table have coordinates (load_coordinates.sh) - DONE
## - <mastermap download>= release_geometries
2022-04-08 06:13:03 -04:00
# for geometry in geometries
# if geometry.TOID not in builings
2022-04-08 06:13:03 -04:00
# Add TOID to temp table called new_geometries
# psql -c "INSERT INTO buildings ( geometry_id, ref_toid ) SELECT geometry_id, source_id from geometries;"
# for building in buildings
2022-04-08 06:13:03 -04:00
# if building.TOID not in new <mastermap download>
# (need a <mastermap download> table with all TOIDs in the new release, but not the old ones too, which geometires has)
# buildings.dynamics_has_demolished_buildings = TRUE
# secondarily, if building.coordinates <10m away from any new_geometry.coordinates
# older_building.dynamics_has_demolished_buildings = TRUE
# link new_geometry TOID in the geometries table to old building and delete duplicate building we just created for new_geometry
2022-04-08 06:13:03 -04:00
# Worry about build dates for switching next