1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "origin": "Union Station, 30 W Pershing Rd, Kansas City, MO 64108",
12 "destination": "Union Station, 30 W Pershing Rd, Kansas City, MO 64108",
13 "stops": [
14 {
15 "label": "Stop A - River Market",
16 "address": "20 E 5th St, Kansas City, MO 64106",
17 "lat": 39.1088,
18 "lng": -94.5818,
19 "priority": 90,
20 "serviceMinutes": 12
21 },
22 {
23 "label": "Stop B - Country Club Plaza",
24 "address": "4706 Broadway Blvd, Kansas City, MO 64112",
25 "lat": 39.0419,
26 "lng": -94.5908,
27 "priority": 100,
28 "serviceMinutes": 15
29 },
30 {
31 "label": "Stop C - Brookside",
32 "address": "6300 Brookside Plaza, Kansas City, MO 64113",
33 "lat": 39.0132,
34 "lng": -94.5919,
35 "priority": 80,
36 "serviceMinutes": 12
37 },
38 {
39 "label": "Stop D - Westport",
40 "address": "4050 Pennsylvania Ave, Kansas City, MO 64111",
41 "lat": 39.0531,
42 "lng": -94.5905,
43 "priority": 85,
44 "serviceMinutes": 10
45 },
46 {
47 "label": "Stop E - Crossroads District",
48 "address": "1901 Baltimore Ave, Kansas City, MO 64108",
49 "lat": 39.0902,
50 "lng": -94.5844,
51 "priority": 95,
52 "serviceMinutes": 12
53 },
54 {
55 "label": "Stop F - 18th & Vine",
56 "address": "1616 E 18th St, Kansas City, MO 64108",
57 "lat": 39.0913,
58 "lng": -94.5632,
59 "priority": 75,
60 "serviceMinutes": 10
61 }
62 ],
63 "maxStops": 10,
64 "maxMinutes": 120,
65 "serviceMinutesPerStop": 12,
66 "averageSpeedMph": 28,
67 "roadCircuityPercent": 128
68};
69
70
71const run = await client.actor("thanh81646/apify-multi-stop-route-and-distance-optimizer").call(input);
72
73
74console.log('Results from dataset');
75console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
76const { items } = await client.dataset(run.defaultDatasetId).listItems();
77items.forEach((item) => {
78 console.dir(item);
79});
80
81