matsim-org / pt2matsim

Package to create a multi-modal MATSim network and schedule from public transit data (GTFS or HAFAS) and an OSM map of the area.
http://www.ivt.ethz.ch/publikationen/studenten/530.html
GNU General Public License v2.0
49 stars 68 forks source link

Extracting and Mapping Transit Data for Specific Areas in Large Networks Generated by pt2matsim. #198

Closed ArezHK closed 7 months ago

ArezHK commented 9 months ago

Hello,

I am attempting to create a multimodal network for my designated area using pt2matsim. While I have successfully constructed the network, I encountered a challenge. Due to the presence of multiple transport companies in my target area and the absence of specific GTFS data for my city, I opted to use a GTFS file for the entire province, Baden-Württemberg, where my city is located. However, the resulting network and schedule files are so large and heavy that my PC struggles to handle the simulation.

Is there a method to extract transit data and map it only for a specific area, perhaps using a shapefile or by filtering GTFS data based on the names of active transportation companies in that region? This way, I could generate a lighter schedule file and network.

Thank you in advance for your assistance.

polettif commented 8 months ago

There's currently no way to spatially filter a GTFS feed in pt2matsim. I'd suggest filtering a feed with other tools and then use the extract as input to pt2matsim. Maybe the resources and libraries here are helpful: https://github.com/MobilityData/awesome-transit?tab=readme-ov-file#gtfs

I can just provide a quick way in R as an example:

library(tidytransit)
gtfs = read_gtfs("gtfs_file.zip")
gtfs_extract = filter_feed_by_area(gtfs, c(lon_min, lat_min, lon_max, lat_max))
write_gtfs(gtfs_extract, "output_file.zip")
ArezHK commented 8 months ago

Dear @polettif , thank you for your assistance and for sharing the R code.