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?
Routing with ferries
-
- Posts: 5
- Joined: Tue Mar 09, 2021 7:41 am
Routing with ferries
Tomasz Lotocki
Sales
PTV Logistics - Poland
Sales
PTV Logistics - Poland
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: Routing with ferries
Hi Tomasz,
sounds like you need the following information:
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:
- Nearest search: com.ptvgroup.xserver.xdata.SegmentsByCoordinateRequest
- Polygon search : com.ptvgroup.xserver.xdata.SegmentsBySurroundingPolygonRequest
- 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 } }
- SegmentIDs can change from map to map version!
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: Routing with ferries
Here's just one more screenshot from my sample application.
It demonstrated the potential outpout of the "ferry search dialog".
Bernd
It demonstrated the potential outpout of the "ferry search dialog".
Bernd
- Attachments
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: Routing with ferries
Another example requested by a partner:
- from Hook van Holland
- to Killingholme
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...