matsim-org/matsim-code-examples

How to find the closest link from a stop

Closed this issue · 4 comments

Hi.
I am planning to create a multimodal network for Tokyo using pt2matsim.

I was able to create the Tokyo network (including the trains).

The problem is that I don't know which link the train stops correspond to.

There is no gtfs data available for everyone in Tokyo, so I have to create my own transit schedule.
When I create a transit schedule, I have to include the link that corresponds to the stop.
Therefore, it is necessary to know the link that the stop corresponds to.

The solution I have in mind is to use JOSM to find the link closest to the train stop, but the number of stations is so large that it would be a tremendous task.

So what I want to ask is: "Can I have it pick the closest link from the coordinate data of the stops? ".

I do have the network and the coordinate data of the stops.
If anyone knows how to solve this problem, please let me know.

Translated with www.DeepL.com/Translator (free version)

If you are comfortable using Java, you could use the NetworkUtils for this.

Link nearestLink = NetworkUtils.getNearestLink(yourNetwork, stopCoordinate)

I guess with an area like Tokyo it is not really an option to do things manually.

The problem is that I don't know which link the train stops correspond to.
[...]
Therefore, it is necessary to know the link that the stop corresponds to.

pt2matsim aims to solve exactly this kind of problem. If you have a look at the workflow you could basically create a MATSim schedule without route and without stop links by hand and then run the PTMapper with the network of your area. The resulting schedule then contains the stop links. You do have all the stop coordinates, but you'll still need the departure times and stop sequences from somewhere (However, I'm not quite sure if you have that available since there's no gtfs data).

Thank you, @Janekdererste , for your valuable advice.

It seems that when mapping the train network in pt2Matsim, it automatically finds the links corresponding to the stops.

Thank you very much for spending your valuable time.

Thank you, @polettif , for your valuable advice.

I didn't know that it was possible to map a train network without stating the stop link.
Thanks to your advice, I was able to recreate the train network in Tokyo.

Thank you very much for spending your valuable time.