[OSRM-talk] Some question/issue using the trips service

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Mon Oct 12 00:44:26 UTC 2020


Never mind! I figured it out after reading the docs yet a few more times.

For anyone else looking, the waypoints are returned in the order you 
send them, if you want them in route order sort the list on 
waypoint_index field.

Sorry for the noise,
   -Steve

On 10/11/2020 3:50 PM, Stephen Woodbridge wrote:
> Hi,
>
> I'm trying to use the trips service and I'm confused by the 
> waypoint_index. If I pass 50 coordinates on input, is this index back 
> to the original list of coordinates?
>
> Because, the lon,lat of the waypoint in the result does not appear to 
> map back to the index of the coordinate in the request. I can see 
> these don't match exactly, but close enough to know something is 
> amiss, probably my understanding.
>
> For example, Here is a list of covered bridges in Vermont with an 
> arbitrary START location in the first location:
>
> [['', 'START', '', 43.16477, -72.8958, '', ''],
> ['Belvidere', 'Mill', 'W off Rte. 109', '44.74373', '-72.74143', 
> '1895', 'Null'],
> ['Belvidere', 'Morgan', 'W off Rte. I 09', '44.74357', '-72.72809', 
> '1887', 'Null'],
> ['Cambridge', 'Grist Mill', 'E off Rte. 108', '44.63668', '-72.82537', 
> '1872', 'Null'],
> ['Cambridge', 'Poland', 'N off Rte. 15', '44.65134', '-72.81465', 
> '1887', '2001'],
> ['Charlotte', 'Holmes Creek', 'W off Rte. 7', '44.33312', '-73.28230', 
> '1870', 'Null'],
> ['Charlotte', 'Sequin', 'E off Quinlan Bridge', '44.28906', 
> '-73.15032', '1850', '1994'],
> ['Charlotte', 'Quinlan\\u0027s', 'Off Rte. 7 to N Ferrisburgh', 
> '44.27641', '-73.18388', '1849', '1950'],
> ['Danville', 'Greenbanks Hollow', 'S off Rte. 2', '44.37762', 
> '-72.12200', '1886', '2002'],
> ['Enosburg', 'Hopkins', 'W next to Rte. 118', '44.92062', '-72.67309', 
> '1875', 'Null'],
> ['Fairfax', 'Maple Street', 'S off Rte. 104', '44.66369', '-73.01043', 
> '1865', '2002'],
> ['Fairfield', 'East Fairfield', 'Adjacent to Rte. 36', '44.78616', 
> '-72.86229', '1865', 'Null'],
> ['Island Pond', 'Island Pond Footbridge', 'At railroad depot off Main 
> St.', '44.81629', '-71.88105', '2003', 'Null'],
> ['Johnson', 'Power House', 'W next to Rte. lOOC', '44.63611', 
> '-72.67041', '1872', '2002'],
> ['Johnson', 'Scribner', 'E off Rte. lOOC', '44.63822', '-72.64855', 
> 'Null', 'Null'],
> ['Lemington', 'Columbia', 'Off Rte. 102 to NH', '44.85324', 
> '-71.55169', '1912', 'Null'],
> ['Lunenburg', 'Mount Orne', 'South Lancaster Rd. to NH', '44.46024', 
> '-71.65270', '1911', '1999'],
> ['Lyndon', 'Schoolhouse', 'Rte. 5 E, Lyndon Corner', '44.51617', 
> '-72.01014', '1879', 'Null'],
> ['Lyndon', 'Chamberlin', 'W off Rte. 5', '44.51659', '-72.01647', 
> '1881', 'Null'],
> ['Lyndon', 'Millers Run', 'On Rte. 122', '44.54220', '-72.00989', 
> '1878', '1995'],
> ['Montgomery', 'Comstock', 'S next to Rte. 118', '44.89963', 
> '-72.64484', '1883', 'Null'],
> ['Montgomery', 'West Hill', 'S off Rte. 118', '44.86762', '-72.64831', 
> '1883', 'Null'],
> ['Montgomery', 'Fuller', 'N next to Rte. 118', '44.90334', 
> '-72.64011', '1890', '2000'],
> ['Montgomery', 'Hectorville', 'W off Rte. 118', '44.85378', 
> '-72.61359', '1883', '2003'],
> ['Montgomery', 'Hutchins', 'W off Rte. 118', '44.85862', '-72.61255', 
> '1883', 'Null'],
> ['Montgomery', 'Longley', 'W next to Rte. 118', '44.90723', 
> '-72.65594', '1863', 'Null'],
> ['Morristown', 'Red', 'W off Rte. l00', '44.51869', '-72.67772', 
> '1896', 'Null'],
> ['Shelburne', 'Shelburne Museum', 'Facing Rte. 7', '44.37700', 
> '-73.22952', '1845', '1950'],
> ['Stowe', 'Emily\\u0027s', 'E off Rte. 100', '44.44048', '-72.67983', 
> '1844', '1969'],
> ['Waterville', 'Village', 'W off Rte. 109', '44.69015', '-72.77098', 
> '1877', 'Null'],
> ['Waterville', 'Montgomery', 'E next to Rte. 109', '44.70573', 
> '-72.76023', '1877', '1998'],
> ['Waterville', 'Codding Hollow', 'E next to Rte. l09', '44.71216', 
> '-72.75624', '1877', 'Null'],
> ['Westford', 'Browns River', 'Off Rte. 128', '44.61259', '-73.00808', 
> '1873', '2001'],
> ['Wolcott', 'Fisher Railroad', 'S off Rte. 15', '44.53248', 
> '-72.42783', '1908', 'Null'],
> ['Brandon', 'Sanderson', 'S off Rte. 7', '43.78966', '-73.11176', 
> '1840', 'Null'],
> ['Chelsea', 'Moxley .', 'E next to Rte. 110', '43.95703', '-72.46340', 
> '1883', 'Null'],
> ['Clarendon', 'Kingsley', 'SW off Rte. 103', '43.52386', '-72.94106', 
> '1870', '2003'],
> ['Coventry', 'Black River', 'Town highway 36', '44.86098', 
> '-72.27332', '1881', 'Null'],
> ['East Montpelier', 'Coburn', 'NW off Rte. 2', '44.28084', 
> '-72.45419', '1851', '1970'],
> ['Hartland', 'Martins Mill', 'E off Rte. 5', '43.53250', '-72.39594', 
> '1881', 'Null'],
> ['Hartland', 'Willard', 'E off Rte. 5', '43.59387', '-72.34945', 
> '1870', 'Null'],
> ['Hartland', '(Willard) Twin', 'E off Rte. 5', '43.59368', 
> '-72.35015', '2001', 'Null'],
> ['Marshfield', 'Orton Farm', 'S off Rte. 2', '44.28756', '-72.40818', 
> '1890', 'Null'],
> ['Middlebury', 'Pulp Mill', 'Seymour St. Ext.', '44.02466', 
> '-73.17748', '1820', '2002'],
> ['Middlebury', 'Halpin', 'E off Rte. 7', '44.05013', '-73.14084', 
> '1850', 'Null'],
> ['Northfield', 'Stony Brook', 'W off Rte. 12A', '44.12040', 
> '-72.68918', '1899', 'Null'],
> ['Northfield', 'Northfield Falls', 'W off Rte. 12', '44.17249', 
> '-72.65146', '1872', 'Null'],
> ['Northfield', 'Slaughter House', 'W off Rte. 12', '44.16856', 
> '-72.65457', '1872', 'Null'],
> ['Northfield', 'Lower Cox Brook', 'W off Rte. 12', '44.17278', 
> '-72.65303', '1872', 'Null'],
> ['Northfield', 'Upper Cox Brook', 'W off Rte. 12', '44.17380', 
> '-72.65556', '1872', '1966'],
> ['Pittsford', 'Depot', 'Off Rte. 7', '43.70956', '-73.04268', '1853', 
> 'Null'],
> ['Pittsford', 'Cooley', 'Proctor Rd.', '43.69045', '-73.02858', 
> '1849', 'Null'],
> ['Pittsford', 'Hammond', 'W off Rte.7', '43.72070', '-73.05356', 
> '1843', 'Null'],
> ['Pittsford', 'Gorham', 'Proctor Rd.', '43.68004', '-73.03753', 
> '1842', 'Null'],
> ['Randolph', 'Kingsbury', 'W next to Rte. 14', '43.88085', 
> '-72.58200', '1904', 'Null'],
> ['Randolph', 'Gifford', 'E of Rte. 14', '43.91625', '-72.55505', 
> '1904', '2001'],
> ['Randolph', 'Barley', 'W off Rte 14', '43.92852', '-72.55509', 
> '1904', 'Null'],
> ['Rutland', 'Twin', 'Storage shed on East Creek', '43.64864', 
> '-72.97267', '1850', 'Null'],
> ['Shoreham', 'Rutland Railroad', 'Off Rte 22A', '43.85933', 
> '-73.25579', '1897', '2008'],
> ['Shrewsbury', 'Brown', 'E off Rte. 7', '43.56632', '-72.91891', 
> '1880', 'Null'],
> ['Springfield', 'Baltimore', 'East of Village', '43.27031', 
> '-72.44825', '1870', '1970'],
> ['Taftsville', 'Taftsville', 'N off Rte. 4', '43.63110', '-72.46772', 
> '1836', 'Null'],
> ['Thetford', 'Union Village', 'Off Rte. 113', '43.78872', '-72.25407', 
> '1867', '1963'],
> ['Thetford', 'Sayres', 'S off Rte 113 to Tucker Hill Rd.', '43.83213', 
> '-72.25278', 'Null', 'Null'],
> ['Troy', 'River Road', '50\\u0027 from Tre. 102 Junction', '44.95639', 
> '-72.39349', '1910', 'Null'],
> ['Tunbridge', 'Howe', 'Bellnap Brook Rd.', '43.86493', '-72.49903', 
> '1879', 'Null'],
> ['Tunbridge', 'Cilley', 'W off Rte. 110', '43.88303', '-72.50390', 
> '1883', 'Null'],
> ['Tunbridge', 'Mill', 'W off Rte. 110 in village', '43.89182', 
> '-72.49158', '1883', '2000'],
> ['Tunbridge', 'Larkin', 'E off Rte. 110', '43.92306', '-72.46550', 
> '1902', 'Null'],
> ['Tunbridge', 'Flint', 'E off Rte. 110', '43.94936', '-72.45862', 
> '1845', 'Null'],
> ['Quechee', 'Quechee Bridge', 'Waterman Hill Rd.', '43.64542', 
> '-72.41905', '1970', '2012'],
> ['Waitsfield', 'Pine Brook', 'E off Rte. 100', '44.20563', 
> '-72.79213', '1872', '1977'],
> ['Waitsfield', 'Great Eddy', 'E off Rte. 100', '44.18949', 
> '-72.82360', '1833', '2001'],
> ['Warren', 'Warren', 'E off Rte. 100', '44.11118', '-72.85703', 
> '1880', '2001'],
> ['Waterbury', 'Best Western', 'Off Rte. 100', '44.34636', '-72.74925', 
> '1972', 'Null'],
> ['Weathersfield', 'Salmond', 'E off Rte 131', '43.42684', '-72.48838', 
> '1875', 'Null'],
> ['Weathersfield', 'Upper Falls', 'S off Rte 131', '43.39868', 

> '-72.52207', '1840', '1975'],
> ['West Windsor', 'Bests', 'S off Rte. 44', '43.45520', '-72.51639', 
> '1889', 'Null'],
> ['West Windsor', 'Bowers', 'Off Rte. 44', '43.46141', '-72.49072', 
> '1919', 'Null'],
> ['Windsor', 'Windsor-Cornish', 'S off Rte. 5', '43.47382', 
> '-72.38398', '1866', 'Null'],
> ['Woodstock', 'Lincoln', 'S next to Rte. 4', '43.60076', '-72.56886', 
> '1877', 'Null'],
> ['Woodstock', 'Union Street', 'Off Rte. 44', '43.62474', '-72.52045', 
> '1969', 'Null'],
> ['Arlington', 'West Arlington', 'S off Rte. 313', '43.10444', 
> '-73.22031', '1852', 'Null'],
> ['Bennington', 'Paper Mill', 'S next to Rte. 67A', '42.91288', 
> '-73.23339', '1889', '2000'],
> ['Bennington', 'Silk', 'S next to Rte. 67A', '42.90951', '-73.22530', 
> '1840', 'Null'],
> ['Bennington', 'Henry', 'S off Rte. 67A', '42.91264', '-73.25464', 
> '1840', 'Null'],
> ['West Dover', 'Hermitage Road', '25 Handle Rd.', '42.92852', 
> '-72.88869', 'Null', 'Null'],
> ['Brattleboro', 'Creamery', 'W on Rte. 9', '42.84990', '-72.58566', 
> '1879', '1917'],
> ['Grafton', 'Kidder Hill', 'S off Rte. 121', '43.16919', '-72.60545', 
> '1870', 'Null'],
> ['Guilford', 'Green River', 'in village', '42.77552', '-72.66723', 
> '1870', 'Null'],
> ['Marlboro', 'Johnny Esau', 'NE on Rte. 109', '42.86922', '-72.71967', 
> '2004', 'Null'],
> ['Newfane', 'Williamsville', 'Off Rte. 30, Dover Rd.', '42.94301', 
> '-72.68684', '1870', '2001'],
> ['Rockingham', 'Bartonsville', 'Off Rte. 103', '43.22417', 
> '-72.53646', '1870', '2012'],
> ['Rockingham', 'Hall', 'N on Rte. 103', '43.13749', '-72.48724', 
> '1870', '1982'],
> ['Rockingham', 'Worrall Bridge', 'Williams Rd', '43.21183', 
> '-72.53555', '1870', 'Null'],
> ['Rockingham', 'Hitchock-Cormier', '1 mile N of village', '43.16148', 
> '-72.55163', '2008', 'Null'],
> ['Sunderland', 'Chiselville', 'Sunderland Rd.', '43.07221', 
> '-73.13313', '1870', 'Null'],
> ['Townshend', 'Scott', 'W off Rte . 30', '43.04874', '-72.69638', 
> '1870', '1980'],
> ['West Dummerson', 'West Dummerston', 'Center Rd. and Rte 30', 
> '42.93665', '-72.61275', '1872', '1998']]
>
> I use this to construct the follow get request. The coordinates are in 
> the order of the list above:
>
> http://router.project-osrm.org/trip/v1/driving/-72.8958,43.16477;-72.74143,44.74373;-72.72809,44.74357;-72.82537,44.63668;-72.81465,44.65134;-73.28230,44.33312;-73.15032,44.28906;-73.18388,44.27641;-72.12200,44.37762;-72.67309,44.92062;-73.01043,44.66369;-72.86229,44.78616;-71.88105,44.81629;-72.67041,44.63611;-72.64855,44.63822;-71.55169,44.85324;-71.65270,44.46024;-72.01014,44.51617;-72.01647,44.51659;-72.00989,44.54220;-72.64484,44.89963;-72.64831,44.86762;-72.64011,44.90334;-72.61359,44.85378;-72.61255,44.85862;-72.65594,44.90723;-72.67772,44.51869;-73.22952,44.37700;-72.67983,44.44048;-72.77098,44.69015;-72.76023,44.70573;-72.75624,44.71216;-73.00808,44.61259;-72.42783,44.53248;-73.11176,43.78966;-72.46340,43.95703;-72.94106,43.52386;-72.27332,44.86098;-72.45419,44.28084;-72.39594,43.53250;-72.34945,43.59387;-72.35015,43.59368;-72.40818,44.28756;-73.17748,44.02466;-73.14084,44.05013;-72.68918,44.12040;-72.65146,44.17249;-72.65457,44.16856;-72.65303,44.17278;-72.65556,44.17380;-73.04268,43.70956;-73.02858,43.69045;-73.05356,43.72070;-73.03753,43.68004;-72.58200,43.88085;-72.55505,43.91625;-72.55509,43.92852;-72.97267,43.64864;-73.25579,43.85933;-72.91891,43.56632;-72.44825,43.27031;-72.46772,43.63110;-72.25407,43.78872;-72.25278,43.83213;-72.39349,44.95639;-72.49903,43.86493;-72.50390,43.88303;-72.49158,43.89182;-72.46550,43.92306;-72.45862,43.94936;-72.41905,43.64542;-72.79213,44.20563;-72.82360,44.18949;-72.85703,44.11118;-72.74925,44.34636;-72.48838,43.42684;-72.52207,43.39868;-72.51639,43.45520;-72.49072,43.46141;-72.38398,43.47382;-72.56886,43.60076;-72.52045,43.62474;-73.22031,43.10444;-73.23339,42.91288;-73.22530,42.90951;-73.25464,42.91264;-72.88869,42.92852;-72.58566,42.84990;-72.60545,43.16919;-72.66723,42.77552;-72.71967,42.86922;-72.68684,42.94301;-72.53646,43.22417;-72.48724,43.13749;-72.53555,43.21183;-72.55163,43.16148;-73.13313,43.07221;-72.69638,43.04874;-72.61275,42.93665?roundtrip=true&source=first 
>
>
> And I get the following response from the service, where the first is 
> indeed the START location. The 2nd waypoint is actually the 2nd 
> waypoint in the input request so would have thought it should have 
> waypoint_index=2 and not 59 as shown below. Hence my confusion.
>
> {'code': 'Ok',
> 'waypoints': [{'waypoint_index': 0, 'trips_index': 0, 'hint': 
> 'DvaYhEn2mIQWAAAABQAAAJoAAAAaAQAAEpuAQTGSNEDLo9ZC-JRYQxYAAAAFAAAAmgAAABoBAACYUQAAfLOn-7GjkgLIsqf7YqSSAgMAnw74H3Us', 
> 'location': [-72.89562, 43.164593], 'name': 'Winhall Hollow Road'},
> {'waypoint_index': 59, 'trips_index': 0, 'hint': 
> 'vUSWhOXTfoAkAAAAAgAAALgAAACwAAAA45HHQWZhkj9kFgBDXi0aQyQAAAACAAAAuAAAALAAAACYUQAA9Q2q-yG8qgLKDar7MryqAgcA3wH4H3Us', 
> 'location': [-72.741387, 44.743713], 'name': 'Back Road'},
> {'waypoint_index': 60, 'trips_index': 0, 'hint': 
> 'E9R-gExHloQIAAAACAAAAAAAAAD1AAAAC4C-QJ_tnEAAAAAAFanlQggAAAAIAAAAAAAAAPUAAACYUQAA90Gq-5a7qgLmQar7kruqAgAALwr4H3Us', 
> 'location': [-72.728073, 44.743574], 'name': 'Morgan Bridge Road'},
> {'waypoint_index': 52, 'trips_index': 0, 'hint': 
> 'GlCWhDlQloQOAAAAEQAAAAsAAAD_AwAAIL4hQfJXO0HjzvFACVY0RA4AAAARAAAACwAAAP8DAACYUQAA4cWo--EZqQLmxaj7CBqpAgEA7wX4H3Us', 
> 'location': [-72.825375, 44.636641], 'name': 'Canyon Road'},
> {'waypoint_index': 51, 'trips_index': 0, 'hint': 
> 'DkyWhC1MloQkAAAABAAAAJ0BAACHAAAAiKPKQT1IJEB42o9DQwgVQyQAAAAEAAAAnQEAAIcAAACYUQAA9e-o-0lTqQLG76j7TFOpAgkAnwv4H3Us', 
> 'location': [-72.814603, 44.651337], 'name': 'Cambridge Junction Road'},
>
> [snip to shorten message]
>
> Thanks for any help,
>   -Steve
>





More information about the OSRM-talk mailing list