Traveling salesman API
GET /v1/trip (parameter)
Traveling salesman API computes the most efficient route for visiting all provided coordinates exactly once. Full URL for requests is https://api.strues-maps.lt/v1/trip. Only successful requests are counted towards soft limits and are billed.
Request parameters
points=point1.long,point1.lat;point2.long,point2.lat
Longitude and latitude of waypoints. Coordinates must be supplied in WGS84 projection, also known as EPSG 4326.
api_key=your_personal_api_key
Api key is provided after registration. Api key is used for service configuration like soft limits and billing.
Response codes
200 - Successful response
Request was successfully. Response body contains distance and duration of the fastest route between all pairs of supplied coordinates.
400 - Bad request exception
Returned if parameters are not provided or provided in an invalid format.
401 - Unauthorized
Returned if api key is invalid.
429 - Too many requests
Returned if soft limits are reached.
402 - Payment required
Returned if user has insufficient funds to make a request.
500 - Internal server error
Returned if unexpected error has occurred. We are working on it to resolve it.
Response body
{
"code": "Ok",
"waypoints": [
{
"waypoint_index":0,
"trips_index":0,
"location":[24.1, 55,1],
"name":"gatve g. 10",
"distance":45.259585
}
],
"trips": [
{
"legs": [
{
"steps": [
{
"intersections": [
{
"out": 0,
"entry": [true],
"bearings": [283],
"location": [
23.895149,
54.93023
]
}
],
"driving_side": "right",
"geometry": "ewgnIi...",
"mode": "driving",
"duration": 17.2,
"maneuver": {
"bearing_after": 283,
"type": "depart",
"modifier": "right",
"bearing_before": 0,
"location": [
23.895149,
54.93023
]
},
"weight": 29.2,
"distance": 49.9,
"name": ""
},
{
"intersections": [
{
"in": 0,
"entry": [true],
"bearings": [323],
"location": [
23.930107,
54.908578
]
}
],
"driving_side": "right",
"geometry": "{jcnIyz...",
"mode": "driving",
"duration": 0,
"maneuver": {
"bearing_after": 0,
"type": "arrive",
"modifier": "right",
"bearing_before": 143,
"location": [
23.930107,
54.908578
]
},
"weight": 0,
"distance": 0,
"name": ""
}
],
"distance": 5215.4,
"duration": 524.3,
"summary": "Street A, Street B",
"weight": 588.1
}
],
"distance": 5215.4,
"duration": 524.3,
"weight_name": "routability",
"weight": 588.1,
"geometry": "{jcnIyz...",
}
]
}
code - "Ok" or "NoRoute"
waypoints[i] - An array of waypoint objects, ordered as provided in coordinate list.
waypoints[i].waypoint_index - Order in which coordinates should be visited (starts from 0).
waypoints[i].location - Longitude and latitude of snapped coordinate.
waypoints[i].name - Name of snapped coordinate.
waypoints[i].distance - Distance from original location to snapped location.
trips[i] - An array of route objects, ordered by descending recommendation rank.
trips[i].distance - The distance traveled by the route in meters.
trips[i].duration - The estimated travel time in seconds.
trips[i].geometry - The whole encoded geometry of the route value in polyline format.
trips[i].legs - The legs between the given waypoints, an array of objects.
trips[i].legs[j].distance - The distance traveled by leg in meters.
trips[i].legs[j].duration - The estimated travel time in seconds.
trips[i].legs[j].summary - names of two major roads used, can be empty if route is too short.
trips[i].legs[j].steps[k] - array of objects describing the turn-by-turn instructions.
trips[i].legs[j].steps[k].distance - The distance of travel from the maneuver to the subsequent step, in meters.
trips[i].legs[j].steps[k].duration - The estimated travel time in seconds.
trips[i].legs[j].steps[k].geometry - Encoded geometry of route segment.
trips[i].legs[j].steps[k].name - Name of the road along which travel proceeds.
trips[i].legs[j].steps[k].mode - Mode of transportation, usually "driving".
trips[i].legs[j].steps[k].maneuver - An object representing the maneuver.
trips[i].legs[j].steps[k].maneuver.location - Coordinates of maneuver. Coordinates will be supplied in WGS84 projection,
also known as EPSG 4326.
trips[i].legs[j].steps[k].maneuver.bearing_before - The clockwise angle from true north to the direction
of travel immediately before the maneuver.
trips[i].legs[j].steps[k].maneuver.bearing_after - The clockwise angle from true north to the direction
of travel immediately after the maneuver.
trips[i].legs[j].steps[k].maneuver.type - Type of the maneuver.
turn: a basic turn into direction of the modifier
new name: no turn is taken/possible, but the road name changes. The road can take a turn itself, following modifier.
depart: indicates the departure of the leg.
arrive: indicates the destination of the leg.
merge: merge onto a street (e.g. getting on the highway from a ramp, the modifier specifies the direction of the merge).
ramp: Deprecated. Replaced by on_ramp and off_ramp.
on ramp: take a ramp to enter a highway (direction given my modifier).
off ramp: take a ramp to exit a highway (direction given my modifier).
fork: take the left/right side at a fork depending on modifier.
end of road: road ends in a T intersection turn in direction of modifier.
use lane: going straight on a specific lane.
continue: turn in direction of modifier to stay on the same road.
roundabout: traverse roundabout, has additional field exit with NR if the roundabout is
left. the modifier specifies the direction of entering the roundabout.
rotary: a traffic circle. While very similar to a larger version of a roundabout, it does
not necessarily follow roundabout rules for right of way.
roundabout turn: describes a turn at a small roundabout that should be treated as normal
turn. The modifier indicates the turn direction. Example instruction: At the roundabout turn left.
notification: not an actual turn but a change in the driving conditions. For example the
travel mode. If the road takes a turn itself, the modifier describes the direction.
trips[i].legs[j].steps[k].maneuver.modifier - An optional string indicating the direction change of the
maneuver.
uturn: indicates reversal of direction.
sharp right: a sharp right turn.
right: a normal turn to the right.
slight right: a slight turn to the right.
straight: no relevant change in direction.
slight left: a slight turn to the left.
left: a normal turn to the left.
sharp left: a sharp turn to the left.
trips[i].legs[j].steps[k].maneuver.exit - An optional integer indicating number of the exit to take. The
field exists for roundabouts and rotary type field.
trips[i].legs[j].steps[k].intersections[l] - An intersection gives a full representation of any cross-way
the path passes bay. For every step, the very first intersection corresponds to the location of the maneuver. Further
intersections are listed for every cross-way until the next turn instruction.
trips[i].legs[j].steps[k].intersections[l].location - Coordinates of intersection. Coordinates will be supplied
in WGS84 projection, also known as EPSG 4326.
trips[i].legs[j].steps[k].intersections[l].bearings - A list of bearing values that are available at the
intersection. The bearings describe all available roads at the intersection.
trips[i].legs[j].steps[k].intersections[l].entry - A list of entry flags, corresponding in a 1:1 relationship
to the bearings. A value of true indicates that the respective road could be entered on a valid route. false indicates
that the turn onto the respective road would violate a restriction.
trips[i].legs[j].steps[k].intersections[l].in - index into bearings/entry array. Used to calculate the bearing
just before the turn. Namely, the clockwise angle from true north to the direction of travel immediately before the
maneuver/passing the intersection. Bearings are given relative to the intersection. To get the bearing in the direction
of driving, the bearing has to be rotated by a value of 180. The value is not supplied for depart maneuvers.
trips[i].legs[j].steps[k].intersections[l].out - index into the bearings/entry array. Used to extract the
bearing just after the turn. Namely, The clockwise angle from true north to the direction of travel immediately after
the maneuver/passing the intersection. The value is not supplied for arrive maneuvers.
trips[i].legs[j].steps[k].intersections[l].lanes - array of objects that denote the available turn lanes
at the intersection. If no lane information is available for an intersection, the lanes property will not be present.
trips[i].legs[j].steps[k].intersections[l].lanes[m].indications - an indication (e.g. marking on the road)
specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications
are given in an array, each containing one of the following types.
none: No dedicated indication is shown.
uturn: An indication signaling the possibility to reverse (i.e. fully bend arrow).
sharp right: An indication indicating a sharp right turn (i.e. strongly bend arrow).
right: An indication indicating a right turn (i.e. bend arrow).
slight right: An indication indicating a slight right turn (i.e. slightly bend arrow).
straight: No dedicated indication is shown (i.e. straight arrow).
slight left: An indication indicating a slight left turn (i.e. slightly bend arrow).
left: An indication indicating a left turn (i.e. bend arrow).
sharp left: An indication indicating a sharp left turn (i.e. strongly bend arrow).
trips[i].legs[j].steps[k].intersections[l].lanes[m].valid - a boolean flag indicating whether the lane is a valid choice in the current maneuver.
GET /v1/trip (url template)
Traveling salesman API computes the most efficient route for visiting all provided coordinates exactly once. Full URL for requests is https://api.strues-maps.lt/v1/trip/{points}. Only successful requests are counted towards soft limits and are billed.
URL template
{points} - point1.long,point1.lat;point2.long,point2.lat
Longitude and latitude of waypoints. Coordinates must be supplied in WGS84 projection, also known as EPSG 4326.
Request parameters
api_key=your_personal_api_key
Api key is provided after registration. Api key is used for service configuration like soft limits and billing.
GET /v1/trip (polyline)
Traveling salesman API computes the most efficient route for visiting all provided coordinates exactly once. Full URL for requests is https://api.strues-maps.lt/v1/trip/polyline({polyline}). Only successful requests are counted towards soft limits and are billed.
URL template
{polyline} - geometry encoded in polyline format
Polyline encoded list of points. Coordinates must be supplied in WGS84 projection, also known as EPSG 4326.
Request parameters
api_key=your_personal_api_key
Api key is provided after registration. Api key is used for service configuration like soft limits and billing.