本文整理匯總了Python中graphserver.ext.gtfs.gtfsdb.GTFSDatabase.shape_between方法的典型用法代碼示例。如果您正苦於以下問題:Python GTFSDatabase.shape_between方法的具體用法?Python GTFSDatabase.shape_between怎麽用?Python GTFSDatabase.shape_between使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphserver.ext.gtfs.gtfsdb.GTFSDatabase
的用法示例。
在下文中一共展示了GTFSDatabase.shape_between方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from graphserver.ext.gtfs.gtfsdb import GTFSDatabase [as 別名]
# 或者: from graphserver.ext.gtfs.gtfsdb.GTFSDatabase import shape_between [as 別名]
class DescribeCrossingAtAlightEvent:
def __init__(self, gtfsdb_filename, timezone_name="America/Los_Angeles"):
self.gtfsdb = GTFSDatabase( gtfsdb_filename )
self.timezone_name = timezone_name
@staticmethod
def applies_to(vertex1, edge, vertex2):
# if the stop_sequence is the same before and after the TripAlight was crossed, it means the algorithm crossed in the forward
# direction - because the stop_sequence doesn't get set on a forward alight. If this is true then this is the appropriate time
# to describe the transit trip that led to this alighting
return edge is not None \
and isinstance(edge.payload, graphserver.core.TripAlight) \
and vertex1.state.stop_sequence == vertex2.state.stop_sequence
def __call__(self, vertex1, edge, vertex2, context):
stop_sequence_of_boarding = vertex1.state.stop_sequence
trip_id = vertex1.state.trip_id
alighting_trip_id, alighting_time, alighting_stop_sequences = edge.payload.get_alighting_by_trip_id( trip_id )
what = "Ride trip %s from stop_seq %s to stop_seq %s"%(trip_id, vertex1.state.stop_sequence, alighting_stop_sequences)
where = None
when = None
geom = self.gtfsdb.shape_between( trip_id, vertex1.state.stop_sequence, alighting_stop_sequences )
return NarrativeEvent(what, where, when, geom)