Routing with Sygic API’s for web

1 min read

Sygic Directions API is cloud based service that calculates directions from one location to another.
The simplest calculation can be done just by specifying both origin and destination defined by GPS coordinates and API key.
Directions calculation can be enhanced by using any of the parameters showed below:

  • Waypoints with time windows
  • Avoid specific road types or block of map
  • Type of routing - request a route alternatives: Fastest, shortest and economic.
  • There are different routing parameters taken in account for each different vehicle type such as truck, van or car. Custom vehicles can be defined using available parameters.
  • Units - imperial and metric system
  • Limit the max speed of the vehicle to make ETA more accurate
  • Departure time (used for speed profiles and the most accurate ETA)
  • Speed profiles represent usual traffic on roads at time when vehicle is supposed to drive them

Routing calculations can be done on top of TomTom, HERE and OSM map data. Sygic Directions API is using the same well known routing algorithm as Sygic Professional Mobile navigation developed since 2004.

Only difference is that all computing is done on the cloud which makes the calculation much faster. Simple calculation can be done with URL:

directions.api.sygic.com/v0/api/directions?origin=48.110328,17.127268&destination=48.125577,17.131385&key=yourAPIkey.

API will respond with set of data delivered as JSON. See full example on GitHub Gist.

To visualize calculated route on map, you can use Leaflet and useful polyline encoder. To reduce the bandwidth, Sygic uses Encoded polyline to represent the route shape.

Download simple example here.

Written by Zuzana Mikova