OTP V2 - blocked roads

92 views
Skip to first unread message

Antonio Bucchiarone

unread,
Sep 14, 2021, 3:46:54 PM9/14/21
to OpenTripPlanner Users
Hi all,
what should be the best way to block(eliminate) roads for the journey planning? I would like to add this functionality so that someone can decide which roads must be excluded by the planner in different moments (i.e., works in progress, events, etc..). 

I did some years ago adding an updater but probably now there is a smarter way to manage this aspect.

Thanks a lot
Antonio

Leonard Ehrenfried

unread,
Sep 14, 2021, 4:37:50 PM9/14/21
to Antonio Bucchiarone, Antonio Bucchiarone
Hi Antionio,

presumably you want to do this dynamically at runtime, rather than modifying the OSM input, correct?

We've looked at this problem before and, this is actually not easy, as you would need to know the OSM way ids to do it precisely.

If I were to implement that, I would look into using Waze's CIFS as an input format: https://developers.google.com/waze/data-feed/road-closure-information

This is the "most standard" format I could find that expresses road closures, roadworks etc.

In OTP I would consume this CIFS feed and do geometric calculations to match the geometries/linestrings to the internal street edges and modify the traversal permissions, so that cars cannot pass anymore. An extra complication would be to only match part of an edge - in such a case you would have to split it in multiple parts. Another one is closures that happen in the future.

If you're looking for a regularly updated CIFS feed I might be able to provide one, but I have to check the license first.

As you might have noticed, I've been thinking about this problem for a while and am happy to adivse and help.

Best,
--
  Leonard Ehrenfried

--
Le informazioni contenute nella presente comunicazione sono di natura privata e come tali sono da considerarsi riservate ed indirizzate esclusivamente ai destinatari indicati e per le finalità strettamente legate al relativo contenuto. Se avete ricevuto questo messaggio per errore, vi preghiamo di eliminarlo e di inviare una comunicazione all’indirizzo e-mail del mittente.
--
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you received this in error, please contact the sender and delete the material.


--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner-...@googlegroups.com.

Leonard Ehrenfried

unread,
Sep 15, 2021, 2:00:52 AM9/15/21
to Antonio Bucchiarone, Antonio Bucchiarone
Replying to the list again.

OTP already has facilities for regularly polling an extrenal data source and then updating the graph dynamically. The bike rental updater works like that for example: https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java

I think this can serve as some inspiration for your plans.

The difficult part though will be matching the external data (probably based on coordinates, isn't it?) to the internal model that OTP uses.

If you're looking for a data source to try this with, you can use the CIFS roadworks data feed that my collegue maintains at https://data.mfdz.de/hbg/roadworks/cifs.json

It contains the road closures for the German state of Baden-Württemberg.

Another tip: the OTP developers meet every Tuesday and Thursday at 10am central European time at

This would be a good forum to ask questions.

--
  Leonard Ehrenfried


On Tue, 14 Sep 2021, at 23:05, Antonio Bucchiarone wrote:
Hi Leonard, 
I did some years ago with an ad-hoc updater implementation and through JSON content in the router-config.json file. 
The general idea was to put at Zero the speed of a specific segment. The planner does not use the segment with speed ==0.

I would like to find a smarter way and as you say try to make it very dynamic. We could update this JSON file on a server but OTP must be able to read each interval (few seconds) and updates the info of the graph.

Some ideas?

The same could be valid for bus lines not available, etc. etc..

Thanks
Antonio

Hannes Junnila

unread,
Sep 15, 2021, 11:06:13 AM9/15/21
to OpenTripPlanner Users
Hi,

If the roadworks can be fetched over a standard WFS API, OTP already has an updater to show notes.

You will need to specify a new class however to map from the WFS features to OTP StreetNotes to have the correct information. The following class provides an example for that:


/Hannes

Antonio Bucchiarone

unread,
Oct 26, 2021, 4:53:46 AM10/26/21
to OpenTripPlanner Users
Dear Leonard,

can you share me some examples of the WAZE CIFS? I am trying to implement and updater that consumes these info (as you suggested) and block the roads. In OTP V1 I did this in this way:

Segment segment = new Segment (wayId, startNodeId, endNodeId);
SegmentSpeedSample speed =  new SegmentSpeedSample(0,hourBins);
 result.put(segment, speed);

But NOW in OTPV2 it is not possible.

Do you have any suggestion to re-do in similar ways?

Regards
Antonio
Reply all
Reply to author
Forward
0 new messages