Skip to content

Commit 94222ab

Browse files
authored
Merge pull request #102 from cal-itp/dim-shapes
Dim shapes
2 parents 39aa58b + d3940d4 commit 94222ab

File tree

7 files changed

+1347
-888
lines changed

7 files changed

+1347
-888
lines changed

_shared_utils/shared_utils/geography_utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,16 @@ def make_routes_shapefile(ITP_ID_LIST=[], CRS="EPSG:4326", alternate_df=None):
131131

132132
elif alternate_df is not None:
133133
shapes = alternate_df.copy()
134-
# shape_id is None, which will throw up an error later on when there's groupby
135-
shapes = shapes.assign(
136-
shape_id=shapes.route_id,
137-
)
134+
135+
# With historical gtfs_schedule_type2.shapes table, there is a valid shape_id
136+
if shapes.shape_id.isnull().sum() == 0:
137+
pass
138+
else:
139+
# shape_id is None, which will throw up an error later on when there's groupby
140+
# So, create shape_id and fill it in with route_id info
141+
shapes = shapes.assign(
142+
shape_id=shapes.route_id,
143+
)
138144

139145
# Make a gdf
140146
shapes = gpd.GeoDataFrame(

0 commit comments

Comments
 (0)