Page 1 of 1

Routing with ferries

Posted: Thu Feb 16, 2023 2:20 pm
by Tomasz Lotocki
Hi,
We have a following question from one of our Partners:

I am looking for the most optimal solution using the PTV xServer API, which would reflect the functionality of PTV Map&Guide indicating alternative ferries on the route at selected points. The scenario is as follows:

1. The client provides the coordinates of the starting point A and ending point B, for which I get the route using the calculateRoute endpoint from xRoute.

2. The customer selects a point on this route (we assume that it runs partly by water) for which he would like to receive alternative ferries that could potentially be used to get to the end point B (exactly as in PTV Map&Guide - ppm on map > find ferries).

3. The last step would be for the customer to select one of the proposed ferries and change the course of the original route so that it led from A to B via the newly selected ferry.


How can we assist here?

Re: Routing with ferries

Posted: Thu Feb 16, 2023 3:33 pm
by Bernd Welter
Hi Tomasz,

sounds like you need the following information:
  • We support a so-called com.ptvgroup.xserver.xroute.CombinedTransportViaWaypoint, which is a dedicated ferry connection from one unique start port to a unique destination port. To define such a waypoint you need to provide the combinedTransportId
  • To gather the combinedTransportId you can use the com.ptvgroup.xserver.xdata.SegmentsRequest which enables you to search for such an ID:
  • The search could be based on various approaches:
  • For the SegmentOptions you need to search for SegmentType.COMBINED_TRANSPORT
  • This is a nearest search in the region of Kiel
    • Code: Select all

      {
        "$type": "SegmentsByCoordinateRequest",
        "segmentsOptions": {
          "includedSegmentTypes":["COMBINED_TRANSPORT"]
        },
        "resultFields": {
          "polyline": true,
          "descriptors": true
        },
        "coordinate": {
          "x": 10.132240358,
          "y": 54.323249814
        }
      }
    • Response

      Code: Select all

      {
        "$type": "SegmentsResponse",
        "segments": [
          {
            "type": "COMBINED_TRANSPORT",
            "polyline": {
              "plain": {
                "$type": "Polyline",
                "polyline": [
                  {
                    "x": 10.140115155,
                    "y": 54.319672521
                  },
                  {
                    "x": 11.914234093,
                    "y": 57.695938264
                  }
                ]
              }
            },
            "id": "SEGM00028f61c441v6PFAeoSAeY72m4SlWvidQL9G/oVRsIYzlEa0BvMbh6Za+J5RbckwFUGxgSYGQj2LM1uKKxo8nVatAr+AkfQAI0YCPZlh1M0zS3lRTnjHNtnG6NmhjIe2C7wNUTtf/s="
          }
        ]
      }
  • And here comes the routring request

    Code: Select all

    {
        "waypoints": [
        {
            "$type": "OnRoadWaypoint",
            "location": {
            "coordinate": {
              "x": 10.132240358,
              "y": 54.323249814
            },
            "considerAlternativeNearByRoads": false
          }
        },
        {
          "$type": "CombinedTransportViaWaypoint",
          "combinedTransportId": "SEGM00028f61c441v6PFAeoSAeY72m4SlWvidQL9G/oVRsIYzlEa0BvMbh6Za+J5RbckwFUGxgSYGQj2LM1uKKxo8nVatAr+AkfQAI0YCPZlh1M0zS3lRTnjHNtnG6NmhjIe2C7wNUTtf/s="
        },
        {
          "$type": "OnRoadWaypoint",
          "location": {
            "coordinate": {
              "x": 12.567560214,
              "y": 55.67567061
            }
          }
        }
      ] 
      ,
      "resultFields": {
        "polyline": true
      }
    }
  • Kiel-Gothenburg.png
:idea: Keep this in mind:
  • SegmentIDs can change from map to map version!

Re: Routing with ferries

Posted: Fri Feb 17, 2023 11:31 am
by Bernd Welter
Here's just one more screenshot from my sample application.
It demonstrated the potential outpout of the "ferry search dialog".

Bernd

Re: Routing with ferries

Posted: Thu Sep 07, 2023 8:56 am
by Bernd Welter
Another example requested by a partner:
  • from Hook van Holland
  • to Killingholme
Hook Van Holland - Killingholme.png