Skip to content

Commit a112505

Browse files
committed
use Hudson Square project geometry source data
to correct a ZAP project until we use the lates ZAP data
1 parent 0a30849 commit a112505

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

products/knownprojects/bash/01_dataloading.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ python3 -m python.extractors dcp_n_study_projected
2121
python3 -m python.extractors hpd_rfp
2222
python3 -m python.extractors dcp_planneradded
2323
python3 -m python.extractors dcp_knownprojects
24+
python3 -m python.extractors dcp_hudsonsquare
2425

2526
# Load corrections tables
2627
run_sql_file sql/create_corrections.sql

products/knownprojects/python/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"dcp_n_study_projected": "past_neighborhoodstudies_20260305.zip",
3434
"hpd_rfp": "HPD_RFPs_20250110.xlsx",
3535
"dcp_planneradded": "dcp_planneradded_2025_04_30.csv",
36+
"dcp_hudsonsquare": "HudsonSquare_P2012M0255_4326.zip",
3637
}
3738
DCP_HOUSING_CORRECTIONS_FILENAMES = {
3839
"corrections_dob": "corrections_dob.csv",

products/knownprojects/python/extractors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ def dcp_n_study_projected(filename: str) -> gpd.GeoDataFrame:
7272
return df
7373

7474

75+
@ETL
76+
def dcp_hudsonsquare(filename: str) -> gpd.GeoDataFrame:
77+
# df = gpd.read_file(f"zip://{RAW_DATA_PATH}/{filename}")
78+
79+
filename_prefix = f"{filename}".split(".")[0]
80+
with zipfile.ZipFile(f"{RAW_DATA_PATH}/{filename}", "r") as zip_ref:
81+
zip_ref.extractall(f"{RAW_DATA_PATH}")
82+
df = gpd.read_file(f"{RAW_DATA_PATH}/{filename_prefix}/{filename_prefix}.shp")
83+
return df
84+
85+
7586
@ETL
7687
def hpd_rfp(filename: str) -> pd.DataFrame:
7788
df = pd.read_excel(f"{RAW_DATA_PATH}/{filename}", dtype=str)

products/knownprojects/sql/dcp_application.sql

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,20 @@ geom_ulurp AS (
347347
) AS a LEFT JOIN dcp_zoningmapamendments AS zma
348348
ON a.dcp_ulurpnumber = zma.ulurpno
349349
GROUP BY a.record_id, a.geom
350+
),
351+
352+
-- Correcting geometry for Hudson Square project (P2012M0255) while using old ZAP data
353+
geom_corrections AS (
354+
SELECT
355+
a.record_id,
356+
CASE
357+
WHEN a.record_id = 'P2012M0255'
358+
THEN b.geometry
359+
ELSE a.geom
360+
END AS geom
361+
FROM geom_ulurp AS a
362+
LEFT JOIN dcp_hudsonsquare AS b
363+
ON a.record_id = b.projectid
350364
)
351365

352366
-- Main table with the geometry lookup
@@ -355,5 +369,5 @@ SELECT
355369
b.geom
356370
INTO dcp_application
357371
FROM _dcp_application AS a
358-
LEFT JOIN geom_ulurp AS b
372+
LEFT JOIN geom_corrections AS b
359373
ON a.record_id = b.record_id;

0 commit comments

Comments
 (0)