Get list of countries in route

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
a.laushkin
Posts: 2
Joined: Tue Feb 02, 2021 4:26 pm

Get list of countries in route

Post by a.laushkin »

Hello,
can I get full list of contries inculded in the route in RouteResponse?
User avatar
Bernd Welter
Site Admin
Posts: 2684
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Get list of countries in route

Post by Bernd Welter »

Hello Artem,

request the ResultFields and ask for COUNTRY_EVENTS: Here's a sample route from Luxemburg to Barcelona:

Code: Select all

{
  "waypoints": [
    {
      "$type": "OffRoadWaypoint",
      "location": {
        "offRoadCoordinate": {
          "x": 6.22029,
          "y": 49.61513
        }
      }
    },
    {
      "$type": "OffRoadWaypoint",
      "location": {
        "offRoadCoordinate": {
          "x": 2.1700100683,
          "y": 41.388038574
        }
      }
    }
  ],
  "resultFields": {
    "eventTypes": [
      "COUNTRY_EVENT"
    ]
  }
}
and the response:

Code: Select all

{
  "$type": "RouteResponse",
  "distance": 1160646,
  "travelTime": 55429.948,
  "events": [
    {
      "$type": "CountryEvent",
      "eventType": "COUNTRY_EVENT",
      "coordinate": {
        "x": 6.2202900472,
        "y": 49.615130034
      },
      "distanceFromStart": 0,
      "travelTimeFromStart": 0,
      "country": "LU"
    },
    {
      "$type": "CountryEvent",
      "eventType": "COUNTRY_EVENT",
      "coordinate": {
        "x": 6.1213250692,
        "y": 49.472504164
      },
      "distanceFromStart": 23232,
      "travelTimeFromStart": 1398.32,
      "country": "FR"
    },
    {
      "$type": "CountryEvent",
      "eventType": "COUNTRY_EVENT",
      "coordinate": {
        "x": 2.8653062122,
        "y": 42.465136293
      },
      "distanceFromStart": 998299,
      "travelTimeFromStart": 47117.747,
      "country": "ES"
    }
  ],
  "violated": false
}
Is that what you are looking for?

Bernd
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... :twisted:
a.laushkin
Posts: 2
Joined: Tue Feb 02, 2021 4:26 pm

Re: Get list of countries in route

Post by a.laushkin »

Yes, thanks a lot
Post Reply