How can I list all the stops associated with a route using GTFS?

后端 未结 6 668
执笔经年
执笔经年 2020-12-23 22:49

I\'m working with some GTFS data and would like to be able to create a list of all stops associated served by a route. I don\'t really understand how to do with with GTFS da

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-23 23:20

    If you're working in R you could do this to find routes that stop at your target destination X:

    require(dplyr)
    
    routesX <- routes %>%
      left_join(trips %>% select(trip_id, route_id, shape_id)) %>%
      left_join(stop_times %>% select(trip_id, stop_id)) %>%
      semi_join(stops %>% filter(grepl('X', stop_name, ignore.case = T)), by = c('stop_id' = 'stop_code')) %>%
      select(names(routes), shape_id) %>%
      unique 
    

提交回复
热议问题