Skip to content

Commit

Permalink
Stops without lat/lon are valid, return None for lat/lon getter inste…
Browse files Browse the repository at this point in the history
…ad of throwing
  • Loading branch information
jsteelz committed Sep 30, 2024
1 parent f25d510 commit 8cfbb81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gtfs_loader/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class Stop(Entity):
@cached_property
def location(self):
if self.stop_lat is None or self.stop_lon is None:
raise ValueError(f'Stop {self.stop_id} missing location')
return None

return LatLon(self.stop_lat, self.stop_lon)

Expand Down Expand Up @@ -285,8 +285,11 @@ def last_stop_time(self):

@property
def stop_shape(self):
return tuple(self._gtfs.stops[st.stop_id].location
for st in self._gtfs.stop_times[self.trip_id])
locations = tuple(self._gtfs.stops[st.stop_id].location for st in self._gtfs.stop_times[self.trip_id])

if None in locations:
return None
return locations

@cached_property
def shift_days(self):
Expand Down

0 comments on commit 8cfbb81

Please sign in to comment.