matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 180 forks source link

multimodal network from OSM #132

Closed ngagnediop closed 5 years ago

ngagnediop commented 5 years ago

Hello dear MATSim community, it was a real pleasure to meet you in Leuven in late April, I use MATSim for my thesis in France. I am at the stage of generation of the multimodal network. I am using the org.matsim.pt2matsim.workbench package obtained from https://github.com/matsim-org/pt2matsim. But I encounter two difficulties: 1 / The whole country network has been imported while I only need part of the network (my study perimeter). I used the SNCF gtfs data from all over the country, but with an osm file from my study area. Is there not a mechanism to reduce only the network to my study area? 2 / the last step (Plausibility and editing) was unsuccessful and displays as an error message :

2019-05-28 15:53:10,522  INFO CheckMappedSchedulePlausibility:93 Start plausibility check...
Exception in thread "main" java.lang.NullPointerException
    at org.matsim.pt2matsim.plausibility.PlausibilityCheck.runCheck(PlausibilityCheck.java:153)
    at org.matsim.pt2matsim.run.CheckMappedSchedulePlausibility.run(CheckMappedSchedulePlausibility.java:95)
    at org.matsim.pt2matsim.workbench.PT2MATSimExample.checkPlausibility(PT2MATSimExample.java:193)
    at org.matsim.pt2matsim.workbench.PT2MATSimExample.main(PT2MATSimExample.java:62)

Thanks for your help and if there are other methods to solve it. I try using JOSM but also it does not integrate PT lines and schedules.

polettif commented 5 years ago

1 / The whole country network has been imported while I only need part of the network (my study perimeter). I used the SNCF gtfs data from all over the country, but with an osm file from my study area. Is there not a mechanism to reduce only the network to my study area?

If you want to reduce the MATSim schedule to your area you can use ScheduleCleaner.cutSchedule(). It's best to do this right after converting from GTFS before you perform any other modifications or mapping.

2 / the last step (Plausibility and editing) was unsuccessful and displays as an error message : 2019-05-28 15:53:10,522 INFO CheckMappedSchedulePlausibility:93 Start plausibility check...

Can you provide the input data you used? Otherwise it's hard to tell what went wrong.

ngagnediop commented 5 years ago

Hello, thank you for your answer. For the first question, can you give me more information about using ScheduleCleaner.cutSchedule (). For the second question, since I have no HAFAS data, I used the org.matsim.pt2matsim.workbench package with the example PT2MATSimExample.java that I adapted with my data. I attach the java file here : https://drive.google.com/file/d/1bm4HLcGBhhZ1l6ogwpjZcdC5uOB_FQ9f/view?usp=sharing

I do not know if you will need other data (network.osm, network.xml and sncfgtfs) ? Another question will also be the consideration of buses. I imagine that I have to add the schedules of the public transport and freight agencies to take into account the bus and car intermodality ? Thank you !

polettif commented 5 years ago

I think it's crucial you understand how the steps in the example file work and what they achieve, otherwise you'll have a hard time working with MATSim in general. PT2MATSimExample just shows how to use some of the classes and methods and is not meant as a standalone class that's supposed to work simply with adapted input paths (I'll might have to clarify this sometime). Please have a look at the package workflow and the wiki entries.

Re cutSchedule: There are actually three methods, I guess the easiest to use is ScheduleCleaner.cutSchedule(TransitSchedule schedule, Coord SWcorner, Coord NEcorner) which needs the southwest and northeast corner of the area you'd like to cut. However, there is no main method to simply run the class, you'll have to implement this yourself. As I said, it's best to cut the MATSim schedule right after Gtfs2TransitSchedule has been run.