Calculate travel (driving) distance and time using routing data from Google Maps Platform 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/google?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
TravelMode Drive,Bicycle,Walk,Two_Wheeler,Transit Drive travelmode=drive
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 travelMode = "drive"
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/google?");
	url.Append("key=").Append(key);
	url.Append("&origin=").Append(origin);
    url.Append("&destination=").Append(destination);
    url.Append("&travelmode=").Append(travelMode);
	url.Append("&format=").Append(format);
	message = client.GetAsync(url.ToString()).Result;
}



import requests

def get_georoute_google(api_key, origin, destination, travelmode, response_format="json"):
    """Fetch georoute data using Google endpoint."""
    base_url = "https://geodata.cdxtech.com"
    endpoint = "/api/georoute/google"
    url = f"{base_url}{endpoint}"
    params = {
        "key": api_key,
        "origin": origin,
        "destination": destination,
        "travelmode": travelmode,
        "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"
    travelmode = "drive"
    format = "json"
    data = get_georoute_google(key, origin, destination, travelmode, 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_google(
    api_key: &str,
    origin: &str,
    destination: &str,
    travelmode: &str,
    response_format: &str,
) -> Result> {
    let client = reqwest::blocking::Client::new();
    let resp = client
        .get("https://geodata.cdxtech.com/api/georoute/google")
        .query(&[
            ("key", api_key),
            ("origin", origin),
            ("destination", destination),
            ("travelmode", travelmode),
            ("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 travelmode = "drive";
    let format = "json";

    match get_georoute_google(api_key, origin, destination, travelmode, format) {
        Ok(data) => println!("Response JSON:\n{}", serde_json::to_string_pretty(&data)?),
        Err(err) => eprintln!("Error fetching data: {}", err),
    }

    Ok(())
}



async function getGeorouteGoogle({ key, origin, destination, travelmode, format = "json" }) {
    const baseUrl = "https://geodata.cdxtech.com";
    const endpoint = "/api/georoute/google";
    const params = new URLSearchParams({ key, origin, destination, travelmode, 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 travelmode = "drive";
    const format = "json";
    try {
        const data = await getGeorouteGoogle({ key, origin, destination, travelmode, 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 travelMode As String = "drive"
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("&travelmode=").Append(travelMode)
	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 travelMode As String
Dim format As String
key = "{your-key}"
origin = "40.8481,-74.5726"
destination = "40.9253,-74.1785"
travelmode = "drive"
format = "json"
Client.BaseUrl = "https://geodata.cdxtech.com/api/"
Request.Method = WebMethod.HttpGet
Request.ResponseFormat = WebFormat.Json
Request.Resource = "georoute/google?key={key}&origin={origin}&destination={destination}&travelmode={travelmode}&format={format}"
Request.AddUrlSegment "key", key
Request.AddUrlSegment "origin", origin
Request.AddUrlSegment "destination", destination
Request.AddUrlSegment "travelmode", travelmode
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": "GeoRouteGoogle",
	"url": "https://geodata.cdxtech.com/api/georoute/google?key={your-key}&origin=34.1026760,-118.4524720&destination=33.78750,-117.93320&travelMode=driving&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>GeoRouteGoogle</Service>
    <Url>https://geodata.cdxtech.com/api/georoute/google?key={your-key}&amp;origin=34.1026760,-118.4524720&amp;destination=33.78750,-117.93320&amp;travelMode=driving&amp;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>