Problem with time restrictions


#1

Hi, I’m testing RouteXL route optimization considering to buy the RouteXL 200 subscription.
I’m stucked with a problem that I can’t resolve and I’d like an help to understand the API request/response.

I’ve passed at the site https://www.routexl.nl this list of addresses with ready and due restrictions (Starting time 08:00AM):

And this is the response I got, exactly what I want:

  • 08:00|⌂ VIA BOSCHETTA 52 SAMBUGHÈ 31022 PREGANZIOL TV ITALIA|
  • 08:19|1. VIA BOSCHI A 62 31030 CARBONERA TREVISO ITALIA − Via Boschi, 62, 31030 Carbonera TV, Italy (10 min) ⇨12:00|
  • 08:33|2. VIA COMISSO 7 31030 BREDA DI PIAVE TREVISO ITALIA − Via G. Comisso, 7, 31030 Vacil TV, Italy (10 min) ⇨12:00|
  • 08:47|3. VIA SAN PIO X 4 31030 BREDA DI PIAVE TREVISO ITALIA − Via S. Pio X, 4, 31030 Breda di Piave TV, Italy (10 min) ⇨12:00|
  • 09:13|4. VIA ARCADE 8 31050 POVEGLIANO TREVISO ITALIA − via Arcade 8, 31050 Povegliano Treviso, Italy (10 min) ⇨12:00|
  • 09:28|5. VIA TRENTO 106 31030 ARCADE TREVISO ITALIA − Via Trento, 106, 31030 Arcade TV, Italy (10 min) ⇨12:00|
  • 09:41|6. VIA BAINSIZZA 14 31030 ARCADE TREVISO ITALIA − Via Bainsizza, 14, 31030 Arcade TV, Italy (10 min) ⇨12:00|
  • 09:56|7. VIA CAVOUR 87 31027 SPRESIANO TREVISO ITALIA − via Cavour, 31027 Spresiano Treviso, Italy (10 min) 12:00⇌16:00|
  • 12:27|8. via brigata emilia 5 PERO (31030 ) - ( ) 31030 BREDA DI PIAVE TREVISO ITALIA − via Brigata Emilia 5, 31030 Breda di Piave Treviso, Italy (10 min) 12:00⇌16:00|
  • 13:01|9. VIA BOSCHETTA 52 SAMBUGHÈ 31022 PREGANZIOL TV ITALIA − Via Boschetta, 52, 31022 Preganziol TV, Italy|

My problem happens when I do the same thing using the API service.
This is the locations array that I pass to the endpoint:

"locations": [
    {
      "address": "VIA BOSCHETTA 52 SAMBUGHÈ 31022 PREGANZIOL TV ITALIA",
      "lat": "45.5843",
      "lng": "12.22834"
    },
    {
      "address": "VIA SAN PIO X 4  31030 BREDA DI PIAVE TREVISO ITALIA",
      "lat": "45.72239",
      "lng": "12.33244",
      "ready": 0,
      "due": 240,
      "servicetime": 10
    },
    {
      "address": "VIA BAINSIZZA 14  31030 ARCADE TREVISO ITALIA",
      "lat": "45.79134",
      "lng": "12.23784",
      "ready": 0,
      "due": 240,
      "servicetime": 10
    },
    {
      "address": "VIA TRENTO 106  31030 ARCADE TREVISO ITALIA",
      "lat": "45.78283",
      "lng": "12.2317",
      "ready": 0,
      "due": 240,
      "servicetime": 10
    },
    {
      "address": "VIA BOSCHI A 62  31030 CARBONERA TREVISO ITALIA",
      "lat": "45.68798",
      "lng": "12.29953",
      "ready": 0,
      "due": 240,
      "servicetime": 10
    },
    {
      "address": "VIA COMISSO 7  31030 BREDA DI PIAVE TREVISO ITALIA",
      "lat": "45.70519",
      "lng": "12.30831",
      "ready": 0,
      "due": 240,
      "servicetime": 10
    },
    {
      "address": "VIA ARCADE 8  31050 POVEGLIANO TREVISO ITALIA",
      "lat": "45.76137",
      "lng": "12.20447",
      "ready": 240,
      "due": 480,
      "servicetime": 10
    },
    {
      "address": "VIA CAVOUR 87  31027 SPRESIANO TREVISO ITALIA",
      "lat": "45.7838",
      "lng": "12.2568",
      "ready": 240,
      "due": 480,
      "servicetime": 10
    },
    {
      "address": "via brigata emilia 5 PERO (31030 ) - (  ) 31030 BREDA DI PIAVE TREVISO ITALIA",
      "lat": "45.70293",
      "lng": "12.34391",
      "ready": 240,
      "due": 480,
      "servicetime": 10
    }
  ]

But the response I get is different from what I see on the website. The ready and due restrictions aren’t respected and the route is not the same:

{
  "id": "NGoVsCSZ",
  "count": 9,
  "feasible": true,
  "route": {
    "0": {
      "name": "VIA BOSCHETTA 52 SAMBUGH? 31022 PREGANZIOL TV ITALIA",
      "arrival": 0,
      "distance": 0
    },
    "1": {
      "name": "VIA ARCADE 8  31050 POVEGLIANO TREVISO ITALIA",
      "arrival": 26,
      "distance": 23.3
    },
    "2": {
      "name": "VIA TRENTO 106  31030 ARCADE TREVISO ITALIA",
      "arrival": 41,
      "distance": 27.3
    },
    "3": {
      "name": "VIA BAINSIZZA 14  31030 ARCADE TREVISO ITALIA",
      "arrival": 54,
      "distance": 28.8
    },
    "4": {
      "name": "VIA CAVOUR 87  31027 SPRESIANO TREVISO ITALIA",
      "arrival": 69,
      "distance": 32
    },
    "5": {
      "name": "VIA BOSCHI A 62  31030 CARBONERA TREVISO ITALIA",
      "arrival": 96,
      "distance": 46.9
    },
    "6": {
      "name": "VIA COMISSO 7  31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 110,
      "distance": 49.6
    },
    "7": {
      "name": "VIA SAN PIO X 4  31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 124,
      "distance": 52.9
    },
    "8": {
      "name": "via brigata emilia 5 PERO (31030 ) - (  ) 31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 138,
      "distance": 56.2
    }
  }
}

What am I doing wrong? How do I get the same response I can see on the website?

Thanks in advance.


#2

We did not check all details at this moment, but one important comment we can already make. It may help you going, so we’ll post it without checking your full request.

While the website creates a roundtrip by default, after the last destination returning to the start location, the API does not. Routes created by the API will end at the last point in the locations array. So, one thing to change to get comparable results is adding the start location again at the end of the array when posting it to the API.


#3

I don’t need the roundtrip for my optimization. I have also tried putting the start location at the end of the array too and this is the result:

{
  "id": "JlbxeO0M",
  "count": 10,
  "feasible": true,
  "route": {
    "0": {
      "name": "VIA BOSCHETTA 52 SAMBUGH? 31022 PREGANZIOL TV ITALIA",
      "arrival": 0,
      "distance": 0
    },
    "1": {
      "name": "VIA BOSCHI A 62  31030 CARBONERA TREVISO ITALIA",
      "arrival": 19,
      "distance": 16.6
    },
    "2": {
      "name": "VIA COMISSO 7  31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 33,
      "distance": 19.3
    },
    "3": {
      "name": "via brigata emilia 5 PERO (31030 ) - (  ) 31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 49,
      "distance": 23.1
    },
    "4": {
      "name": "VIA SAN PIO X 4  31030 BREDA DI PIAVE TREVISO ITALIA",
      "arrival": 63,
      "distance": 26.4
    },
    "5": {
      "name": "VIA CAVOUR 87  31027 SPRESIANO TREVISO ITALIA",
      "arrival": 86,
      "distance": 39.3
    },
    "6": {
      "name": "VIA BAINSIZZA 14  31030 ARCADE TREVISO ITALIA",
      "arrival": 101,
      "distance": 42.5
    },
    "7": {
      "name": "VIA TRENTO 106  31030 ARCADE TREVISO ITALIA",
      "arrival": 114,
      "distance": 43.9
    },
    "8": {
      "name": "VIA ARCADE 8  31050 POVEGLIANO TREVISO ITALIA",
      "arrival": 130,
      "distance": 47.9
    },
    "9": {
      "name": "VIA BOSCHETTA 52 SAMBUGH? 31022 PREGANZIOL TV ITALIA",
      "arrival": 166,
      "distance": 71.4
    }
  }
}

It’s still different from what I see on the website and with ready and due times not respected.


#4

The ready and due time should be in an array restrictions.


#5

Thank you! I haven’t noticed that ready and due must be inserted in a restrictions array.
Can I have an example of how the locations JSON is built with restrictions?


#6
{
	"address": "VIA SAN PIO X 4  31030 BREDA DI PIAVE TREVISO ITALIA",
	"lat": 45.72239,
	"lng": 12.33244,
	"servicetime": 10,
	"restrictions": {
		"ready": 0,
		"due": 240
	}
}