1

Routing tool throuh Remote API

(edited by filipe2s 16/06/2021 16:48:49)

Topic: Routing tool throuh Remote API

Hello,

Ive been trying to find a way to execute thruogh the Remote API, the "Routing" tool on the Wialon Hosting platform (see image below), I would like to provide the coordinates of all points in a non optimized order and get in return the optimized order and total time and distance
https://forum.gurtam.com/misc.php?action=pun_attachment&item=12988&download=0

The closest I got was through the comand "svc=route/optimize", but one of the parameters is a matrix with the distance in time between all points, wich I dont have, I only have coordinates, is there a way to get those distances? Or maybe another command to execute the "routing" tool?

Thanks in advance for any help,

Cheers,

Filipe

2

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

Hi Filipe!

Please find the example of request to get optimized route via coordinates here https://forum.gurtam.com/viewtopic.php? … 65#p180665

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Routing tool throuh Remote API

(edited by filipe2s 21/06/2021 11:43:34)

Re: Routing tool throuh Remote API

Hello Diana, thank you for your suport!

I've not been able to get it working thou, can you clarify the notation on that post you mentioned?

Also, theres no better way to optimize a set of more than two points? without having to get the distance between all them first?

Thank you again!

Filipe

4

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

Hi Filipe!

1) You can try to use  travelling salesman algorithm to get best route to visit all stated points - please look here the request notation
https://sdk.wialon.com/wiki/en/sidebar/ … e/optimize

2) You can use other external algorithm, like for example Google The Directions API overview - https://developers.google.com/maps/docu … s/overview

I've not been able to get it working thou, can you clarify the notation on that post you mentioned?

You just need to execute POST request

Request URL: https://routing-maps.wialon.com/hst-api … _waypoints

Form Data

data: {"origin":{"lat":40.48117173371407,"lon":-3.7986716290313143},"destination":{"lat":40.42421952957767,"lon":-3.532253172037599},"waypoints":[{"lat":40.38134294113712,"lon":-3.503414060713493},{"lat":40.32797053959649,"lon":-3.749233152476114}],"flags":0}
uid: 930848
sid: 022116d81746227638dd821bbfd41a60

where data is collection of points (coordinates)
uid - the user ID
sid - session ID

You can look an example on Wialon web-interface, tool "Routing"   via Developers Console

Diana Cheley
Wialon Hosting Expert
Gurtam
5

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

Thanks again for your support

I keep getting the Invalid session error, does it needs to be a diferent login from the one used on hst-api.wialon.com?

6

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

I think I'm doing something wrong with the notation, can you check it please:

https://routing-maps.wialon.com/hst-api.wialon.com/gis_get_route_via_waypoints&params={"origin":{"lat":40.48117173371407,"lon":-3.7986716290313143},"destination":{"lat":40.42421952957767,"lon":-3.532253172037599},"waypoints":[{"lat":40.38134294113712,"lon":-3.503414060713493},{"lat":40.32797053959649,"lon":-3.749233152476114}],"flags":0}&uid=22825336&sid=...

7

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

filipe2s wrote:

I think I'm doing something wrong with the notation, can you check it please:

https://routing-maps.wialon.com/hst-api.wialon.com/gis_get_route_via_waypoints&params={"origin":{"lat":40.48117173371407,"lon":-3.7986716290313143},"destination":{"lat":40.42421952957767,"lon":-3.532253172037599},"waypoints":[{"lat":40.38134294113712,"lon":-3.503414060713493},{"lat":40.32797053959649,"lon":-3.749233152476114}],"flags":0}&uid=22825336&sid=...

Hello!

Have you specified the sid value? Also before execute this request you need to login under certain user, then use session sid which you get

Diana Cheley
Wialon Hosting Expert
Gurtam
8

Routing tool throuh Remote API

Re: Routing tool throuh Remote API

Yes, I'm doing the login request first and using the sid in the end. Its working fine with other requests im doing, thats why I thouth it was something with the notation on this one