Skip to content

Commit

Permalink
Merge pull request #25 from olincollege/center-a-b
Browse files Browse the repository at this point in the history
Add A or B id to the crosswalk centers
  • Loading branch information
cory0417 authored Feb 11, 2025
2 parents 93ebb86 + 99567a1 commit a6c4095
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/night_light/GIS_predictor/crosswalk_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,22 @@ def find_crosswalk_centers(con: duckdb.DuckDBPyConnection):
JOIN intersection_mid i USING (crosswalk_id)
)
SELECT
*
FROM centers;
crosswalk_id,
street_segment_id,
ped_edge_geom,
street_center_point,
geometry,
CASE
WHEN rn = 1 THEN 'A'
WHEN rn = 2 THEN 'B'
ELSE NULL
END AS center_id
FROM (
SELECT
*,
ROW_NUMBER() OVER (PARTITION BY crosswalk_id ORDER BY geometry) AS rn
FROM centers
) sub;
"""
)

Expand Down

0 comments on commit a6c4095

Please sign in to comment.