Use this endpoint to find the distance and general drive time between two points.
Street Route
The Street Route Cloud API provides a convenient online solution for retrieving the distance (measured in miles or kilometers) and estimated driving duration between two sets of latitude and longitude coordinates.
You can use Street Route to:
- Find the distance and general drive time between two points
- Create a ‘Find the Nearest Location’ tool.
- Using a database of ‘known / owner destinations’, Street Route can be used to compare a starting point location to the database to return all the route distances and drive times to the possible destinations, which can be queried by the user to present the shortest distance or travel time to the end user.
- Determine geolocations which our data sources tell us cannot be reached by vehicle travel.
- This differentiates Street Route from other distance solutions which return ‘As the crow flies’ distances. Examples are geo points to islands, or rural off road residences.
Documentation
Useful Resources
Product Page
Support Center
License Key - The License Key issued by Melissa.
Options - List options in the following format, with multiple options delimited with a ,. For example: optionName:parameter,optionName:parameter. These options are case-sensitive and camel case.
arriveAt:< yyyy-mm-ddThh:mm:ss.mmmZ >- Specify the arrival time ISO 8601 UTC.avoid:< borderCrossings | ferries | tollRoads | tunnels | unpavedRoads >- Specify the types of transport obstacles to avoid.departAt:< yyyy-mm-ddThh:mm:ss.mmmZ | now >- Specify the departure date and time in ISO 8601 UTC. Default isnow- departs immediately.routeType:< eco | fastest | shortest | thrilling >- Specify the type of route.eco- Balances travel time and fuel efficiency.fastest- Optimizes for fastest travel time.shortest- Optimizes for shortest travel distance.thrilling- Optimized for challenging, hilly, or winding routes.
traffic:< false | true >- Considers current traffic conditions. Default istrue.travelMode:< bicycle | car | pedestrian >- Specify the type of vehicle used for the travel mode. Default iscar.vehicleCommercial:< false | true >- Indicates if the vehicle is a commercial vehicle. Default isfalse.vehicleHeight:< [float] | 0 >- Specifies the vehicle height in meters. There are no height restrictions. Default is0.vehicleLength:< [float] | 0 >- Specifies the vehicle length in meters. Default is0.vehicleMaxSpeed:< [integer] | 0 >- Specifies the maximum vehicle speed in km/hr. Default is0.vehicleWeight:< [integer] | 0 >- Specifies the vehicle weight in kilograms. Minimum value is1.
Transmission Reference - Serves as a unique request identifier. It is returned as sent.
Units - This specifies the returned distance unit scale. Use mi for miles and km for kilometers.
Ending Latitude - The street route ending latitude.
Ending Longitude - The street route ending longitude.
Starting Latitude - The street route starting latitude.
- Street Route Serverhttps://streetroute.melissadata.net/v1/WEB/StreetRoute/getDistance
- curl
- C#
- Python
- Java
- JavaScript
- Node.js
- PHP
- Go
- Ruby
- R
- C#+Newtonsoft
- Java8+Apache
- Payload
curl -i -X GET \
'https://streetroute.melissadata.net/v1/WEB/StreetRoute/getDistance?id={REPLACE-WITH-YOUR-LICENSE-KEY}&endLatitude=33.64987&endLongitude=-117.58296&startLatitude=33.63752&startLongitude=-117.60692'Default response from a GET request
Comma delimited status, error codes, and change codes for the record. For more information, see Street Route Result Codes.
This is a string value that is the set unit of measurement for the TotalDrivingDistance field.
Lists error codes from any errors caused by the most recent request as a whole. For more information, see Street Route Result Codes.
This is a string value with the total driving distance. Refer to the Units field to know what unit of measurement it is.
{ "Results": "SR01", "Units": "mi", "TransmissionResults": "", "TravelTime": "00:05:05", "TotalDrivingDistance": "1.865353", "TransmissionReference": "Test", "Version": "8.2.1.0" }
Street Route Request Body
The License Key issued by Melissa.
Options - List options in the following format, with multiple options delimited with a ,. For example: optionName:parameter,optionName:parameter. These options are case-sensitive and camel case.
arriveAt:< yyyy-mm-ddThh:mm:ss.mmmZ >- Specify the arrival time ISO 8601 UTC.avoid:< borderCrossings | ferries | tollRoads | tunnels | unpavedRoads >- Specify the types of transport obstacles to avoid.departAt:< yyyy-mm-ddThh:mm:ss.mmmZ | now >- Specify the departure date and time in ISO 8601 UTC. Default isnow- departs immediately.routeType:< eco | fastest | shortest | thrilling >- Specify the type of route.eco- Balances travel time and fuel efficiency.fastest- Optimizes for fastest travel time.shortest- Optimizes for shortest travel distance.thrilling- Optimized for challenging, hilly, or winding routes.
traffic:< false | true >- Considers current traffic conditions. Default istrue.travelMode:< bicycle | car | pedestrian >- Specify the type of vehicle used for the travel mode. Default iscar.vehicleCommercial:< false | true >- Indicates if the vehicle is a commercial vehicle. Default isfalse.vehicleHeight:< [float] | 0 >- Specifies the vehicle height in meters. There are no height restrictions. Default is0.vehicleLength:< [float] | 0 >- Specifies the vehicle length in meters. Default is0.vehicleMaxSpeed:< [integer] | 0 >- Specifies the maximum vehicle speed in km/hr. Default is0.vehicleWeight:< [integer] | 0 >- Specifies the vehicle weight in kilograms. Minimum value is1.
Transmission Reference - Serves as a unique request identifier. It is returned as sent.
Units - This specifies the returned distance unit scale. Use mi for miles and km for kilometers.
Array of request records.
This is a string value containing a unique identifier for the current record. Use this to match the record submitted with the record returned. It will return what is inputted.
- Street Route Serverhttps://streetroute.melissadata.net/v1/WEB/StreetRoute/getDistance
- curl
- C#
- Python
- Java
- JavaScript
- Node.js
- PHP
- Go
- Ruby
- R
- C#+Newtonsoft
- Java8+Apache
- Payload
curl -i -X POST \
https://streetroute.melissadata.net/v1/WEB/StreetRoute/getDistance \
-H 'Content-Type: application/json' \
-d '{
"CustomerID": "{REPLACE-WITH-YOUR-LICENSE-KEY}",
"Options": "avoid:tunnels,routeType:shortest",
"TransmissionReference": "Test",
"Units": "mi",
"Records": [
{
"RecordID": "1",
"StartLatitude": "33.637520",
"StartLongitude": "-117.606920",
"EndLatitude": "33.649870",
"EndLongitude": "-117.582960"
},
{
"RecordID": "2",
"StartLatitude": "40.712776",
"StartLongitude": "-74.005974",
"EndLatitude": "34.052235",
"EndLongitude": "-118.243683"
}
]
}'Default response from a POST request
This is a string value that is the set unit of measurement for the TotalDrivingDistance field.
Lists error codes from any errors caused by the most recent request as a whole. For more information, see Street Route Result Codes.
{ "Version": "8.2.1.0", "Units": "mi", "TransmissionReference": "Test", "TransmissionResults": "", "TotalRecords": "2", "Records": [ { … }, { … } ] }