chairemobilite / transition

Transition is a modern new approach to transit planning. It's a web application to model, simulate and plan public transit and alternative transportation.
http://transition.city
MIT License
20 stars 13 forks source link

Move RoutingResult classes to chaire-lib, add tests and use common interface #963

Closed tahini closed 3 weeks ago

tahini commented 1 month ago

This commit is part of work to move the routing calculations to chaire-lib instead of Transition, so that other tools can benefit from it (#954).

The main result interface is called RoutingResult. 2 classes implement it UnimodalRoutingResult and TransitRoutingResult. There is no need to call the getWalkOnlyRoute method anymore (it has been removed), as it is not part of the interface and required custom code. Rather, the getPath method will return either a Route or TrRoutingRoute in the TransitRoutingResult class.

Tests have been added for the results class. TransitRoutingResult required to be split between the common chaire-lib part (the class itself) and the transition part (requiring a PathCollection to get the geojson from transition paths). A parameter allows to specify how to retrieve the geojson from the route data.

The result classes may still be improved later, as the route calculations are also moved to chaire-lib, to find more common grounds or add better types to route properties. This is mostly moving what currently exists, with minimal changes to existing code.

greenscientist commented 1 month ago

Without having looked at the code, I would name the TransitRoutingResult MultimodalRoutingResult. (Would a bike->carshare route be called Transit or something else ??)

tahini commented 1 month ago

Without having looked at the code, I would name the TransitRoutingResult MultimodalRoutingResult. (Would a bike->carshare route be called Transit or something else ??)

Currently, the class is really for transit result. When we really have Multi modal, we can revisit it and make it really generic for this kind of data.

tahini commented 3 weeks ago

Incidentally also fixes #286