Skip to content

Commit 43e13ac

Browse files
Update examples/geospatial-python-urban-analysis-with-postgis/src/etl/transform/district.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent de60008 commit 43e13ac

File tree

1 file changed

+2
-0
lines changed
  • examples/geospatial-python-urban-analysis-with-postgis/src/etl/transform

1 file changed

+2
-0
lines changed

examples/geospatial-python-urban-analysis-with-postgis/src/etl/transform/district.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
def spatial_join(bus_stops: gpd.GeoDataFrame, comunas: gpd.GeoDataFrame):
66
"""Join bus stops with districts based on spatial location."""
7+
if bus_stops.crs != comunas.crs:
8+
raise ValueError(f"CRS mismatch: bus_stops CRS is {bus_stops.crs}, comunas CRS is {comunas.crs}")
79
return gpd.sjoin(bus_stops, comunas, how="inner", predicate="within")
810

911
def count_stops_per_district(bus_stops_in_district: gpd.GeoDataFrame):

0 commit comments

Comments
 (0)