Page 1 of 1

Get list of countries in route

Posted: Fri Feb 05, 2021 7:33 am
by a.laushkin
Hello,
can I get full list of contries inculded in the route in RouteResponse?

Re: Get list of countries in route

Posted: Fri Feb 05, 2021 7:59 am
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

Re: Get list of countries in route

Posted: Fri Feb 05, 2021 10:57 am
by a.laushkin
Yes, thanks a lot