Calculate travel (driving) distance and time using routing data from HERE Technologies with worldwide routing and rooftop geocoding. Driving, Walking, Transit and other travel modes are supported.
Request Details
Example Request Url
https://geodata.cdxtech.com/api/georoute/here?key={key}&origin={origin}&destination={destination}&transportmode={transportmode}&routingmode={routingmode}&geocode={geocode}&format={format}
Description | Required | Default Value | Example | |
key | Authentication Key | key=dd76pxfi4feydh4bz_dtrjyf6flu4-987asdjhajkd555usds28ad984yhz | ||
Origin | Origin Point, Landmark, or Address | origin=40.8481,-74.5726 | ||
Destination | Destination Point, Landmark, or Address | destination=40.9253,-74.1785 | ||
TransportMode | Car, Truck or Pedestrian | car | transportmode=car | |
RoutingMode | Fast or Short | fast | routingmode=fast | |
Geocode | Set to true to geocode both origin and destination | false | geocode=true | |
format | Output Formatting | json | format=json (supported formats: json, xml) |
Coding Examples
Here are some coding examples to get you started. Please feel free to contact support if you need additional assistance.
string key = "{your-key}";
string origin = "40.8481,-74.5726"
string destination = "40.9253,-74.1785"
string transportMode = "car"
string routingMode = "fast"
string geocode = "false"
string format = "json";
HttpResponseMessage message = null;
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri("https://geodata.cdxtech.com");
StringBuilder url = new StringBuilder("/api/georoute/here?");
url.Append("key=").Append(key);
url.Append("&origin=").Append(origin);
url.Append("&destination=").Append(destination);
url.Append("&transportmode=").Append(transportMode);
url.Append("&routingMode=").Append(routingMode);
url.Append("&geocode=").Append(geocode);
url.Append("&format=").Append(format);
message = client.GetAsync(url.ToString()).Result;
}
import requests
def get_georoute_here(api_key, origin, destination, transportmode, routing_mode, geocode, response_format="json"):
"""Fetch route data using HERE endpoint."""
base_url = "https://geodata.cdxtech.com"
endpoint = "/api/georoute/here"
url = f"{base_url}{endpoint}"
params = {
"key": api_key,
"origin": origin,
"destination": destination,
"transportmode": transportmode,
"routingMode": routing_mode,
"geocode": geocode,
"format": response_format,
}
response = requests.get(url, params=params)
response.raise_for_status()
try:
return response.json()
except ValueError:
return response.text
if __name__ == "__main__":
key = "{your-key}"
origin = "40.8481,-74.5726"
destination = "40.9253,-74.1785"
transportmode = "car"
routing_mode = "fast"
geocode = "false"
format = "json"
data = get_georoute_here(key, origin, destination, transportmode, routing_mode, geocode, format)
import json
if isinstance(data, (dict, list)):
print(json.dumps(data, indent=2))
else:
print(data)
// Cargo.toml
// [dependencies]
// reqwest = { version = "0.11", features = ["blocking", "json"] }
// serde = { version = "1.0", features = ["derive"] }
// serde_json = "1.0"
use std::error::Error;
fn get_georoute_here(
api_key: &str,
origin: &str,
destination: &str,
transportmode: &str,
routing_mode: &str,
geocode: &str,
response_format: &str,
) -> Result> {
let client = reqwest::blocking::Client::new();
let resp = client
.get("https://geodata.cdxtech.com/api/georoute/here")
.query(&[
("key", api_key),
("origin", origin),
("destination", destination),
("transportmode", transportmode),
("routingMode", routing_mode),
("geocode", geocode),
("format", response_format),
])
.send()?
.error_for_status()?;
let json: serde_json::Value = resp.json()?;
Ok(json)
}
fn main() -> Result<(), Box> {
let api_key = "{your-key}";
let origin = "40.8481,-74.5726";
let destination = "40.9253,-74.1785";
let transportmode = "car";
let routing_mode = "fast";
let geocode = "false";
let format = "json";
match get_georoute_here(api_key, origin, destination, transportmode, routing_mode, geocode, format) {
Ok(data) => println!("Response JSON:\n{}", serde_json::to_string_pretty(&data)?),
Err(err) => eprintln!("Error fetching data: {}", err),
}
Ok(())
}
async function getGeorouteHere({ key, origin, destination, transportmode, routingMode, geocode, format = "json" }) {
const baseUrl = "https://geodata.cdxtech.com";
const endpoint = "/api/georoute/here";
const params = new URLSearchParams({ key, origin, destination, transportmode, routingMode, geocode, format });
const url = `${baseUrl}${endpoint}?${params.toString()}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const text = await response.text();
try {
return JSON.parse(text);
} catch {
return text;
}
}
// Example usage:
(async () => {
const key = "{your-key}";
const origin = "40.8481,-74.5726";
const destination = "40.9253,-74.1785";
const transportmode = "car";
const routingMode = "fast";
const geocode = "false";
const format = "json";
try {
const data = await getGeorouteHere({ key, origin, destination, transportmode, routingMode, geocode, format });
console.log("Response:", data);
} catch (err) {
console.error("Error fetching data:", err);
}
})();
Dim key As String = "{your-key}"
Dim origin As String = "40.8481,-74.5726"
Dim destination As String = "40.9253,-74.1785"
Dim transportMode As String = "car"
Dim routingMode As String = "fast"
Dim geocode As String = "false"
Dim format As String = "json"
Dim message As HttpResponseMessage = Nothing
Using client As New HttpClient()
client.BaseAddress = New Uri("https://geodata.cdxtech.com")
Dim url As New StringBuilder("/api/georoute/here?")
url.Append("key=").Append(key)
url.Append("&origin=").Append(origin)
url.Append("&destination=").Append(destination)
url.Append("&transportmode=").Append(ttransportMode)
url.Append("&routingmode=").Append(routingMode)
url.Append("&geocode=").Append(geocode)
url.Append("&format=").Append(format)
message = client.GetAsync(url.ToString()).Result
End Using
The following is for the VBA-WEB Excel template available at http://vba-tools.github.io/VBA-Web/
Dim Client As New WebClient
Dim Request As New WebRequest
Dim key As String
Dim origin As String
Dim destination As String
Dim transportMode As String
Dim routingMode As String
Dim geocode As String
Dim format As String
key = "{your-key}"
origin = "40.8481,-74.5726"
destination = "40.9253,-74.1785"
transportmode = "car"
routingmode = "fast"
geocode = "false"
format = "json"
Client.BaseUrl = "https://geodata.cdxtech.com/api/"
Request.Method = WebMethod.HttpGet
Request.ResponseFormat = WebFormat.Json
Request.Resource = "georoute/here?key={key}&origin={origin}&destination={destination}&transportmode={transportmode}&routingmode={routingmode}&geocode={geocode}&format={format}"
Request.AddUrlSegment "key", key
Request.AddUrlSegment "origin", origin
Request.AddUrlSegment "destination", destination
Request.AddUrlSegment "transportmode", transportmode
Request.AddUrlSegment "routingmode", routingmode
Request.AddUrlSegment "geocode", geocode
Request.AddUrlSegment "format", format
Set Response = Client.Execute(Request)
Output Examples
Here are some output data examples. You can also use the Report Generator tab to export specific data files.
{
"service": "GeoRouteHERE",
"url": "https://geodata.cdxtech.com/api/georoute/here?key={your-key}&origin=34.1026760,-118.4524720&destination=33.78750,-117.93320&transportmode=car&routingmode=fast&geocode=false&format=json",
"status": "Success",
"tokenCharge": 2,
"message": null,
"totalResults": 1,
"results": [{
"travelDistance": 48.370019,
"travelDuration": 3249.0
}],
"usage": {
"used": 2597,
"usedPercentage": 1.315582843,
"remaining": 197403,
"remainingPercentage": 98.684417157
},
"duration": 0.9913322,
"timeStamp": "2017-07-24T09:55:29.5369088-04:00"
}
<Root>
<Service>GeoRoute</Service>
<Url>https://geodata.cdxtech.com/api/georoute/here?key={your-key}&routeStart=34.1026760,-118.4524720&routeEnd=33.78750,-117.93320&transportMode=car&routingmode=fast&geocode=false&format=xml</Url>
<Status>Success</Status>
<TokenCharge>2</TokenCharge>
<Message />
<TotalResults>1</TotalResults>
<Results>
<TravelDistance>48.370019</TravelDistance>
<TravelDuration>3249</TravelDuration>
</Results>
<Usage>
<Used>2599</Used>
<UsedPercentage>1.316609338</UsedPercentage>
<Remaining>197401</Remaining>
<RemainingPercentage>98.683390662</RemainingPercentage>
</Usage>
<Duration>0.1123689</Duration>
<TimeStamp>2017-07-24T09:55:31.9213573-04:00</TimeStamp>
</Root>