Time Domain Usage in Routing Services

This section provides an example of a routing request that results in notices about time restrictions, and how time restriction intervals are represented through Time Domain notation.

# request
curl -X GET \
  'https://router.hereapi.com/v8/routes?origin=47.512627,19.049259&destination=47.5072999,19.0507577&return=polyline,summary&transportMode=bus&departureTime=2022-11-08T02:30:11&lang=en-us&apikey={YOUR_API_KEY}'

Image: Route with time restriction notices.

route with time restriction notices
Figure 1. route with time restriction notices
// response with polyline omitted for brevity
{
  "routes": [
    {
      "id": "8490cccc-5728-4f1f-b78d-ba2c9518e9b4",
      "sections": [
        {
          "id": "56d26194-2e81-4662-9d00-5d84e992adc7",
          "type": "vehicle",
          "departure": {
            "time": "2022-11-08T02:30:11+01:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 47.5126642,
                "lng": 19.0492851
              },
              "originalLocation": {
                "lat": 47.5126269,
                "lng": 19.049259
              }
            }
          },
          "arrival": {
            "time": "2022-11-08T02:32:37+01:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 47.5073007,
                "lng": 19.0507227
              },
              "originalLocation": {
                "lat": 47.5072998,
                "lng": 19.0507577
              }
            }
          },
          "summary": {
            "duration": 146,
            "length": 1291,
            "baseDuration": 146
          },
          "polyline": "BGwl...3IgjB3ImDG",
          "notices": [
            {
              "title": "Violated vehicle restriction.",
              "code": "violatedVehicleRestriction",
              "severity": "critical",
              "details": [
                {
                  "type": "restriction",
                  "cause": "Route violates time-dependent restriction",
                  "timeDependent": true,
                  "restrictedTimes": "++*(t2){d5}(h0){h7}*(t2){d5}(h9){h15}+(t1){d1}(t7){d1}"
                }
              ]
            }
          ],
          "transport": {
            "mode": "bus"
          }
        }
      ]
    }
  ]
}

Time restrictions reported in the notices:

Restriction intervals in Time Domain format: ++*(t2){d5}(h0){h7}*(t2){d5}(h9){h15}+(t1){d1}(t7){d1}

  • +(t1){d1}(t7){d1} : On Sunday and Saturday, for duration of 1 whole day.

  • *(t2){d5}(h9){h15} : From Monday, for a duration of 5 days (i.e. Monday to Friday), starting at 9:00 a.m. for a duration of 15 hours (i.e. 9:00 a.m. to 12:00 a.m.).

  • *(t2){d5}(h0){h7} : From Monday, for a duration of 5 days (i.e. Monday to Friday), starting at 12:00 a.m. for a duration of 7 hours (i.e. 12:00 a.m. to 7:00 a.m.).

Restriction applies on Saturday and Sunday, for the duration of entire day, and From 12:00 a.m. to 7:00 a.m. and 9:00 a.m. to 12:00 a.m. on Monday to Friday, every week, every year.

results matching ""

    No results matching ""