stadtnavi / digitransit-ui

Digitransit UI Clone, especially for the city of Herrenberg ("stadtnavi.de")
https://stadtnavi.de/
Other
13 stars 14 forks source link

Booking On-Demand Transport (Taxi) #350

Closed leonardehrenfried closed 3 years ago

leonardehrenfried commented 3 years ago

In Herrenberg after 9pm some busses are replaced with Taxis that you need to book in advance.

For example, when you want to travel from Nufringen to Gültstein at 10 pm, you will receive something that looks like a normal bus route: https://tinyurl.com/yds6qdkz

Screenshot from 2021-05-31 09-26-21

Flex mode

However, you can also book a special mode that will take you directly to your door (if it's within 300m of a bus stop). We want to show this mode in a separate "tile" next to the cycling, p+r ... modes. This is the "Taxi" Icon that we are using combined with the public transit icon for the new flex mode tile: TaxiIcon.zip

Screenshot from 2021-05-31 10-04-01

The icon should be a car with a bus in the background.

In this tile, you need to add the modes FLEX_DIRECT, FLEX_EGRESS. The result should then look like this.

Screenshot from 2021-05-31 10-09-40

Booking info

Also in both cases you must get additional data from the GraphQL API about the following booking requirements:

We have added new GraphQL properties for the booking info and with the following query you can get the message, telephone number and URL.

URL: https://api.dev.stadtnavi.eu/otp/routers/default/index/graphql

query{
  plan(
    date: "2021-06-02"
    time: "22:30"
    from: { lat:  48.6226, lon: 8.8879 }
    to: { lat: 48.5755, lon: 8.8795 }
    transportModes: [
      { mode: RAIL },
      { mode: FLEX, qualifier: EGRESS },
      { mode: FLEX, qualifier: DIRECT },
      { mode: WALK },
    ],
    maxWalkDistance: 5000
  ) {
    itineraries {
      legs {
        mode
        rentedBike
        distance
        startTime
        endTime
        pickupBookingInfo {
          message
          contactInfo {
            phoneNumber
            infoUrl
            bookingUrl
          }
        }
        route {
          url
          mode
          shortName
        }
        trip {
          gtfsId
          tripShortName
        }
        from {
          name
          bikeRentalStation {
            name
            id
          }
        }
        to {
          name
          bikeRentalStation {
            name
            id
          }
        }
      }
    }
  }
}

The new part is:

 pickupBookingInfo {
          message
          contactInfo {
            phoneNumber
            infoUrl
            bookingUrl
          }
        }
patrickbeck1337 commented 3 years ago

I have to say that this ticket is very unclearly formulated. We might need to have a chat about this one @leonardehrenfried.

leonardehrenfried commented 3 years ago

That's a valid point.

The point is that we don't know what is going to be possible so I can't really specify it it any better.

I hope I can clarify over the next couple of days.

derhuerst commented 3 years ago

I'm currently writing a script that can generate GTFS-Flex and patch it into the main GTFS dataset. If there aren't any unintuitive gotchas in the GTFS-Flex spec, and if OTP2 can properly make use of the data, this should be the cleanest and most maintainable way forward.

leonardehrenfried commented 3 years ago

If it wasn't clear, @patrickbeck1337, this means that we will try hard to go with the second option.

derhuerst commented 3 years ago

The aforementioned GTFS-Flex script is here: https://github.com/derhuerst/generate-herrenberg-gtfs-flex

It cannot patch stop_times.txt yet though, but that is required for GTFS-Flex to work (it provides the links between the "normal" GTFS data and the GTFS-Flex-specific files locations.geojson & booking_rules.txt). I will work on that now.

derhuerst commented 3 years ago

OTP PRs related to GTFS-Flex:

derhuerst commented 3 years ago

generate-herrenberg-gtfs-flex can generate booking_rules.txt & locations.geojson and patch stop_times.txt now, but I haven't tested or validated the output yet.

Will have a look what OTP2 does with it.

derhuerst commented 3 years ago

from the Zulip chat:

please don't include it yet Jannis. we need a special patch provided by Hannes Junnila for it to work. Jannis and I have seen huge performance problems using GTFS-Flex and are not sure what the source of it is.

derhuerst commented 3 years ago

As discussed in a private chat, we had the problem that, while OTP successfully routed to an address within the flex area in "Flex egress" mode, it didn't pick up the "run" in "normal" mode.

This PR changes stop_times.txt Flex rows not to references the flex area directly, but a location group that contains both the regular stop as well as the flex area.

https://github.com/derhuerst/generate-herrenberg-gtfs-flex/pull/1

With the code in the PR, generate-herrenberg-gtfs-flex will now generate locations.geojson, location_groups.txt & booking_rules.txt and patch stop_times.txt.

derhuerst commented 3 years ago

We have tried running with the data generated by this PR, but it seems that OTP2 doesn't like it either.

https://github.com/derhuerst/generate-herrenberg-gtfs-flex/pull/1#issuecomment-848781374

I will now change generate-herrenberg-gtfs-flex to duplicate the entire non-flex trip, into a flex trip. Edit: https://github.com/derhuerst/generate-herrenberg-gtfs-flex/pull/2

leonardehrenfried commented 3 years ago

I've updated the ticket and would be grateful if the participants could take a look and spot any mistakes.

derhuerst commented 3 years ago

As Leonard mentioned in the Zulip chat, the latest changes (https://github.com/derhuerst/generate-herrenberg-gtfs-flex/pull/2) seem to work in OTP2, so I merged it.

Denis306 commented 3 years ago

@andreashelms Reopening and putting it to "In Review" so @leonardehrenfried can deploy on dev/QA for testing.

ahmed-nawar commented 3 years ago

image

leonardehrenfried commented 3 years ago

The missing translation is a technical limitation which we cannot solve easily, however you're right with the spacing.