New Kotlin Multiplatform client for OTP2

76 views
Skip to first unread message

Sean Barbeau

unread,
Apr 7, 2021, 12:26:44 PM4/7/21
to OpenTripPlanner Developers
Hi all,
I just wanted to give the community a heads up that we're working on a Kotlin Multiplatform Mobile (KMM) client for OTP2:

This project is designed to make it simple to call the REST API and get a parsed response back, such as:

private lateinit var planApi: PlanApi
...
val requestParameters = RequestParameters(
  fromPlace = latLong(41.84712, -87.64678),
  toPlace = latLong(41.84584, -87.65214),
  arriveBy = "false")
planApi = PlanApi("https://10.0.2.2:8080/otp/routers/default/plan",  requestParameters)
planApi.getPlan(
    success = { launch (Main) {
        Log.d(TAG, "logData: $it")
    } },
    failure = ::handleError
)

Target platforms for use as a library are:
1. Android
2. iOS
3. JVM (desktop/server Java/Kotlin)

Supported OTP APIs (so far) are:
1. Plan API
2. Bike Rental API
3. Server Info API

We plan to use this in the OneBusAway Android and iOS apps, as well as another desktop project we're working on.

KMM is new for us so while the code is implemented, we're still working on publishing the artifacts for use (as well as fleshing out unit tests). But if anyone else has KMM experience and wants to take a look, we'd welcome the feedback!

Thanks to Sudarshan Sampathkumar for most of the heavy lifting on this.

Sean

Sean Barbeau
Center for Urban Transportation Research
University of South Florida

Stefan de Konink

unread,
Apr 7, 2021, 12:31:14 PM4/7/21
to Sean Barbeau, OpenTripPlanner Developers
Hi Sean,

About two years ago we started with a Kotlin (then Flutter) client based on
the OpenJourneyPlanner interface, but converted to gRPC. If you consider
the "HAFAS API" as something universally used, OJP in replacing that in
Europe.

OSDM <https://github.com/UnionInternationalCheminsdeFer/OSDM> is a great
path by the UIC adopting OJP via a REST interface.

So I would hope that if you create some client, you don't tailor make it
for OTP2, but rather a fully adopted standard.

--
Stefan

Sean Barbeau

unread,
Apr 7, 2021, 12:36:36 PM4/7/21
to Stefan de Konink, OpenTripPlanner Developers
Thanks for the tip, I'll check it out!

Our immediate need for the project funding this at USF is to be able to query an OTP2 server, but I'd certainly be interested in expanding it to a standards-based approach as well.

Sean

Reply all
Reply to author
Forward
0 new messages