Reputation: 31
I am working with matrix API https://docs.mapbox.com/api/navigation/matrix/
When I try to add the coordinates given in above link in my system and try i am getting proper result.
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/-122.42,37.78;-122.45,37.91;-122.48,37.73?approaches=curb;curb;curb&access_token=<%access Token%>&sources=0&destinations=1,2
But when I am trying realtime data I am getting below error
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/3.08,101.58;3.09,101.57;3.10,101.63;3.06,101.55;3.13,101.68;3.10,101.66?access_token=<%access token%>&sources=0&destinations=1,2,3,4
{ message: "Coordinate is invalid: 3.08,101.58", code: "InvalidInput" }
Can please help me with what the issue with coordinates
Upvotes: 0
Views: 581
Reputation: 7856
One thing also causing the Coordinate is invalid error
is a redundant ;
after the last pair of coordinates, so instead of e.g.
-117.17282,32.71204;-117.1470279,32.7048179;
use
-117.17282,32.71204;-117.1470279,32.7048179
Upvotes: 0
Reputation: 31
Fixed the issue.
I was using Lat,Long but map box is expecting long,lat. So below URL worked for me
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/101.63553013450047,3.099813715520299;101.65939106660886,3.1136978510187237;101.61475910726944,3.0845580973251456;101.67690052758046,3.1154119291453943;101.67346729993896,3.1075271466768917;101.66076435766543,3.083872446415484?access_token=<%AccessToken%>&sources=0&destinations=1;2;3;4
Upvotes: 1