Route Optimization API

Route Optimization API - Patherizer (a solution to vehicle routing problem) is a cross browsers REST API supporting now a maximum of 100 stops per route or request including the start destination and the end destination. Beeing a multi stop route optimization software, Patherizer may be used by multiple calls to calculate and optimize routes for multiple vehicles, each vehicle with its optimized route. If you need a route optimization API for Electric Vehicles please click here. The route optimization algorythm is based per TSP (travel salesman problem) and it always calculate the shortest route betwween current stop and the next stop until it reaches the end destination. The input addresses are geocoded, so the JSON response will include latitude and longitude of each stop. If the route optimization API cannot recognize one or more of the input addresses it will not geocode these inputs and the API request will return a JSON Error as specified in the errors table. The JSON response also includes distances between each stops along the optimized route (in miles or km) and most important, the durration (in seconds) and durration in real traffic conditions (in seconds) at the time you make the request. A total distance of the optimized route is computed and also a total time. Travel mode may be driving or bicycling or walking, so different kind of niches might be targeted by your app.

Allthough this Route Optimization API is intended for software development and therefore developers, we have also here an online application that may be used to get listed the optimized route from the input text basically you input start address, end address and multi stop addresses (no matter the order) along the route separated by ";" Basically for Route Optimization API you send an authorized POST request in JSON format to the API endpoint and you get as JSON response a representing the optimized route in segments as you need to go. You may use it for commercial purposes for paid packages.

Route Optimization APP or API is useful for a large number of domains like: driving route optimizer, delivery routing software, vehicle routing problem, fleet routing software etc.

For using our API and/or APP you must create an account (free of charge, no card required), activate it from your received email, login and then start your TRIAL package with no fees as you can see at our pricing packages. After you have tested the Route Optimization API and/or APP and if you are satisfied, you may buy a paid package. You will always see at your Admin Console page the real resources consumption in real time, your invoices, you may see/edit/delete your profile or export log consents as GDPR instructed, you may read our FAQs.

Route Optimization APP




Distance Units:
Travel Mode:



API Endpoint (method POST):
https://gatiosoft.ro/roa.aspx
Headers:
Authorization: Basic //Your username:password are base64 encoded string
Content-Type: application/json
Accept: application/json
JSON Request Body (change inputs here and see in real time below):
{
"start_address":"38th St NW & Woodley Rd NW, Washington, DC",
"end_address":"5051 Klingle St NW, Washington, DC",
"addresses":"2700 Wisconsin Avenue Northwest, Washington DC;3601 Macomb Street Northwest, Washington DC;3511 Lowell Street Northwest, Washington",
"units":"km",
"travel_mode":"driving"
}
JSON Response From API (change inputs here and see in real time below):
{
  "segments": [
    {
      "origin": "38th St NW & Woodley Rd NW, Washington, DC 20016, USA",
      "destination": "3601 Macomb St NW, Washington, DC 20016, USA",
      "origin_latitude": 38.93202,
      "origin_longitude": -77.07422,
      "destination_latitude": 38.933712,
      "destination_longitude": -77.07113,
      "distance": 432.0,
      "time": 115,
      "time_in_traffic": 90,
      "toll": ""
    },
    {
      "origin": "3601 Macomb St NW, Washington, DC 20016, USA",
      "destination": "3511 Lowell St NW, Washington, DC 20016, USA",
      "origin_latitude": 38.933712,
      "origin_longitude": -77.07113,
      "destination_latitude": 38.9328,
      "destination_longitude": -77.06978,
      "distance": 222.0,
      "time": 47,
      "time_in_traffic": 46,
      "toll": ""
    },
    {
      "origin": "3511 Lowell St NW, Washington, DC 20016, USA",
      "destination": "2700 Wisconsin Ave, Washington, DC 20007, USA",
      "origin_latitude": 38.9328,
      "origin_longitude": -77.06978,
      "destination_latitude": 38.92476,
      "destination_longitude": -77.073616,
      "distance": 1108.0,
      "time": 203,
      "time_in_traffic": 150,
      "toll": ""
    },
    {
      "origin": "2700 Wisconsin Ave, Washington, DC 20007, USA",
      "destination": "5051 Klingle St NW, Washington, DC 20016, USA",
      "origin_latitude": 38.92476,
      "origin_longitude": -77.073616,
      "destination_latitude": 38.9317,
      "destination_longitude": -77.1025543,
      "distance": 3316.0,
      "time": 471,
      "time_in_traffic": 411,
      "toll": ""
    }
  ],
  "total_distance": 5078.0,
  "total_time": 836,
  "total_time_in_traffic": 697,
  "totals_summary": "Total Distance [km]=5.078; Total time [hh:mm]=0:14; Total time in traffic [hh:mm]=0:12"
}
JSON Response (Example) From API in case of ERROR:

 {
  "cd": "1001",
  "description": "The authorization header is either empty or isn't Basic"
}

Optimized Route Sorted Segments

Origin
38th St NW & Woodley Rd NW, Washington, DC 20016, USA
Destination
3601 Macomb St NW, Washington, DC 20016, USA
Distance
0.43 km
Duration
00:01:55
Duration in Traffic
00:01:30
Tolls
null

Origin
3601 Macomb St NW, Washington, DC 20016, USA
Destination
3511 Lowell St NW, Washington, DC 20016, USA
Distance
0.222 km
Duration
00:00:47
Duration in Traffic
00:00:46
Tolls
null

Origin
3511 Lowell St NW, Washington, DC 20016, USA
Destination
2700 Wisconsin Ave, Washington, DC 20007, USA
Distance
1.108 km
Duration
00:03:23
Duration in Traffic
00:02:30
Tolls
null

Origin
2700 Wisconsin Ave, Washington, DC 20007, USA
Destination
5051 Klingle St NW, Washington, DC 20016, USA
Distance
3.316 km
Duration
00:07:51
Duration in Traffic
00:06:51
Tolls
null

Request Parameters Table

Parameter Name
Parameter Description
start_address
This is the input start address [string] typed in plain text that will be used as the first point of the optimized route. Example:  38 Woodley Road Northwest, Washington DC
end_address
This is the input end address [string] typed in plain text that will be used as the last point of the optimized route. If you want to return to the start point you may input the same address as the start address. You cannot leave this field empty, but if you do not need to type an end address for your optimized route just put an arbitrary valid end address because the algorythm calculates the optimized route without the end address. It just connects the last address of the optimized route with the end address, so this is not really an issue. Example:  5051 Klingle Street Northwest, Washington, DC
addresses
These are all the addresses [string] along the route separated by ";" Maximum 98 addresses, so that means a maximum of 100 addresses per request per route if we consider also the start and the end addresses. Don't type here start address and end address, only addresses between, no matter the order. Example:
2700 Wisconsin Avenue Northwest, Washington DC;3601 Macomb Street Northwest, Washington DC; 3511 Lowell Street Northwest, Washington
units
This parameter defines which units [string] will be considered calculating the distance between each route segment origin and destination. Its values may be km or mi so it means kilometers or miles.
travel_mode
This parameter defines which travel_mode [string] will be used for calculating the distance between each route segment origin and destination. Its values may be driving or bicycling or walking.

Response Parameter Table

Parameter Name
Parameter Description
optimized_route
This is the RootObject (not a parameter) that includes an array field called segments and four other fields total_distance (in km or mi), total_time (in seconds), total_time_in_traffic (in seconds) and totals_summary (string). These fields will be detailed below.
segments
This is an array containing each segment of the optimized route. The segments are sorted from the first to the last in the order the optimized route must be passed. The array contains the following fields: origin, origin_latitude, origin_longitude, destination, destination_latitude, destination_longitude, distance, time, time_in_traffic, toll, each of the fields is explained below.
origin
This is the origin address [string] of the segment. Example: 2700 Wisconsin Avenue Northwest, Washington DC
destination
This is the destination address [string] of the segment. Example: 3511 Lowell Street Northwest, Washington
origin_latitude
This is the origin latitude of the segment as [real] number. It may be a negative number. Example: 40.243587
origin_longitude
This is the origin longitude of the segment as [real] number. It may be a negative number. Example: 20.293886
destination_latitude
This is the destination latitude of the segment as [real] number. It may be a negative number. Example: 41.549527
destination_longitude
This is the destination longitude of the segment as [real] number. It may be a negative number. Example: 21.847597
distance
This is the distance as [real] number between origin and destination of the segment as [meters]. Example: 5678
time
This is the average time in [seconds] as [integer] number necessary to go from origin to destination of the segment. Example: 1227
time_in_traffic
This is the real time in traffic conditions at the time the request has been made in [seconds] as [integer] number necessary to go from the origin to the destination of the segment. Example: 1325
toll
This is the toll cost for travelling the segment as [string] number. If not present it will be null. Example: 5.84 USD
total_distance
This is the total distance of the optimized route as [real] number in [meters]. Example: 5843
total_time
This is the total average time to travel the optimized route as [real] number in [seconds]. Example: 57643
total_time_in_traffic
This is the total time in real traffic conditions at the moment you make the request to travel the optimized route as [real] number in [seconds]. Example: 55893
totals_summary
This is a summarizing field [string] for total distance (in [km] or [mi]) depending of the value of the units parameter from request, total average time as [hh:mm] and total time in real traffic conditions [hh:mm] at the moment you make the request to travel the optimized route. Example: Total Distance [km]=5,078; Total time [hh:mm]=0:14; Total time in traffic [hh:mm]=0:12

Response Error Codes Tablee Error Codes Table

Parameter Name
Parameter Description
cd

This is the error code which may be:

  • 1001
  • 1002
  • 1003
  • 1004
  • 1005
  • 1006
  • 1007
  • 1008
  • 1009
  • 1010
  • 1011
  • 1012
  • 1013
  • 1014
  • 1015
  • 2001
description

This is the description of the error code which may be:

  • 1001 - The authorization header is either empty or isn't Basic.
  • 1002 - Daily requests number exceeded in TRIAL mode!
  • 1003 - Trial expired!
  • 1004 - Addresses number exceeded!
  • 1005 - Package expired!
  • 1006 - No invoice!
  • 1007 - Reader is NULL for TRIAL!
  • 1008 - Cannot Read if TRIAL exists!
  • 1009 - Error connecting to database looking for TRIAL! (and a detailed description message of the encountered error)
  • 1010 - Reader is NULL for Invoice!
  • 1011 - Cannot Read if Invoice exists!
  • 1012 - Error connecting to database! (and a detailed description message of the encountered error)
  • 1013 - Input request string too long! Maximum 100 addresses per request are allowed
  • 1014 - Invalid request data! (and a detailed description message of the encountered error)
  • 1015 - The request cannot exceed 100 addresses!
  • 2001 - Invalid request data after passing to the API (and a detailed description message of the encountered error)

Source Code Examples for Using Our Route Optimization API

                       
Imports System.IO
Imports System.Net
Imports System.Web.Script.Serialization

Public Class route_optimization_api
    Inherits System.Web.UI.Page 
    Public Structure RequestFields
        Dim start_address As String
        Dim end_address As String
        Dim addresses As String
        Dim travel_mode As String
        Dim units As String
    End Structure
    
    Public Structure ResponseFields
        Dim segments As New Segment()
        Dim total_distance As Single
        Dim total_time As Integer
        Dim total_time_in_traffic As Integer
        Dim totals_summary As String
    End Structure

     Public Structure Segment
        Dim origin As String
        Dim destination As String
        Dim origin_latitude  As Single
        Dim origin_longitude As Single
        Dim destination_latitude As Single
        Dim destination_longitude As Single
        Dim distance As Single
        Dim time As Integer
        Dim time_in_traffic As Integer
        Dim toll As String
     End Structure

    Public Structure ErrorFields
        Dim cd As String
        Dim description As String
    End Structure
    
Protected Sub SendRequest()
        Dim Client As WebClient = New WebClient()
        Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes("your_username:your_password"))
        Client.Headers(HttpRequestHeader.Authorization) = String.Format("Basic {0}", credentials)
        Client.Headers(HttpRequestHeader.Accept) = "application/json"
        Client.Headers(HttpRequestHeader.ContentType) = "application/json"
        Client.BaseAddress = "https://gatiosoft.ro/roa.aspx"
        Dim j As RequestFields = New RequestFields()
        j.start_address "38 Woodley Road Northwest, Washington DC!" 
        j.end_address="5051 Klingle Street Northwest, Washington, DC" 
        j.addresses = "2700 Wisconsin Avenue Northwest, Washington DC;3601 Macomb Street Northwest, Washington DC; 3511 Lowell Street Northwest, Washington"
        j.units = "km"      
        
        Try
            Dim js As String = (New JavaScriptSerializer()).Serialize(j)
            Dim reqString As Byte() = Encoding.[Default].GetBytes(js)
            Dim url As Uri = New Uri(Client.BaseAddress)
            Dim resByte As Byte() = Client.UploadData(url, "post", reqString)
                      
            Dim resString As String = Encoding.[Default].GetString(resByte)
            If Instr(resString,"total_distance")>0 Then 
               'In case we got it right without errors
               Dim r as ResponseFields = New ResponseFields()
               Dim j1 As JavaScriptSerializer = New JavaScriptSerializer()
               'Below we find in r.total_distance the value which may be
               'used in further calculations.
               r = j1.Deserialize(Of ResponseFields)(resString)
            Else 'So in case of error occurence
               Dim e as ErrorFields = New ErrorFields()
               Dim j2 As JavaScriptSerializer = New JavaScriptSerializer()
               'Below we find in e.cd (error code) and e.description (error description)
               e = j1.Deserialize(Of ErrorFields)(resString)
            End If
            Client.Dispose()
        Catch exception As System.Exception
            Dim ex As System.Exception = exception
            Console.Writeline("ERROR: " & ex.Message)
        End Try
    End Sub
End Class



Vehicle Routing Problem Video Presentation

Vehicle Routing Problem solved by Delivery Routing Software - Patherizer - is in the video presentation below. Our driving route optimizer or multi stop route optimizer is a very useful tool for any kind of activity that implies route optimization. You can use it as a standalone route optimization app or, as a developer, you can access it from your own app or apps.

 



Pricing Packages

Please choose one of the below pricing packages for start using our Route Optimization API and online APP!

Start TRIAL
No catches

  • 7 days TRIAL
  • Use our cloud REST API and online APP with travel modes like driving, bicycling or walking(*)
  • Maximum 10 addresses(**) per each request
  • Maximum 10 requests per DAY in trial period
  • You do NOT own the commercial copyright in trial period.
  • Get Optimized Route for input addresses and selected travel mode
  • Get Geocoding(***) data (latitude and longitude) for each address
  • Get Distance [m] between each segment's origin and destination of the optimized route
  • Get Average Time [seconds] between each segment's origin and destination of the optimized route
  • Get Real Time In Traffic Conditions [seconds] (where available) at the moment you make the request between each segment's origin and destination of the optimized route
  • Get Tolls for each segment of the optimized route (where available)
  • Get Total Distance (km or mi) of the optimized route
  • Get Total Average Time (hh:mm) of the optimized route
  • Get Total Time In Real Traffic Conditions (hh:mm) of the optimized route
  • For Fleet Vehicles Routing you may make requests for each vehicle, so each vehicle will get its optimized route
  • Administration console
  • Support through online chat and/or tickets
  • We do NOT allow spam accounts for TRIAL



Monthly TIER
Popular

  • 90 USD per month
  • Use our cloud REST API and online APP with travel modes like driving, bicycling or walking(*)
  • Maximum 100 addresses(**) per each route / request
  • Maximum 50 requests per MINUTE
  • You own the commercial copyright with NO additional fee.
  • Maximum 3000 input addresses(*) per MONTH (same requested addresses will be counted also)
  • Get Optimized Route for input addresses and selected travel mode
  • Get Geocoding(***) data (latitude and longitude) for each address
  • Get Distance [m] between each segment's origin and destination of the optimized route
  • Get Average Time [seconds] between each segment's origin and destination of the optimized route
  • Get Real Time In Traffic Conditions [seconds] (where available) at the moment you make the request between each segment's origin and destination of the optimized route
  • Get Tolls for each segment of the optimized route (where available)
  • Get Total Distance (km or mi) of the optimized route
  • Get Total Average Time (hh:mm) of the optimized route
  • Get Total Time In Real Traffic Conditions (hh:mm) of the optimized route
  • For Fleet Vehicles Routing you may make requests for each vehicle, so each vehicle will get its optimized route
  • Administration console
  • Support through online chat and/or tickets



Yearly TIER
(15% Discount)

  • 918 USD per year
  • Use our cloud REST API and online APP with travel modes like driving, bicycling or walking(*)
  • Maximum 100 addresses(**) per each route / request
  • Maximum 50 requests per MINUTE
  • You own the commercial copyright with NO additional fee.
  • Maximum 3000 input addresses(*) per MONTH (same requested addresses will be counted also)
  • Get Optimized Route for input addresses and selected travel mode
  • Get Geocoding(***) data (latitude and longitude) for each address
  • Get Distance [m] between each segment's origin and destination of the optimized route
  • Get Average Time [seconds] between each segment's origin and destination of the optimized route
  • Get Real Time In Traffic Conditions [seconds] (where available) at the moment you make the request between each segment's origin and destination of the optimized route
  • Get Tolls for each segment of the optimized route (where available)
  • Get Total Distance (km or mi) of the optimized route
  • Get Total Average Time (hh:mm) of the optimized route
  • Get Total Time In Real Traffic Conditions (hh:mm) of the optimized route
  • For Fleet Vehicles Routing you may make requests for each vehicle, so each vehicle will get its optimized route
  • Administration console
  • Support through online chat and/or tickets



Notes:
VAT rate may be added or not, function to your country and/or if you are a taxable person or company.
* If you select different travel mode and calculate the route (even for the same input addresses) these addresses are counted also for each selected travel mode.
** Address - may be an exact address (recommended), a street address without number, a city, even a country.
*** Geocoding - if for one or more input addresses the API cannot geocode it, meaning the API cannot get the latitude and the longitude, then the optimized route will not be calculated and you will not be charged. If all the input addresses will be geocoded but calculating one or more segments of the optimized route cannot be done (for example there are no routes betwwen origin and destination) then the optimized route cannot be calculated and you will be charged.