Geocode (get latitude and longitude from addresses) and reverse geocode (get addresses from latitude and longitude). Data is sourced from Bing Maps, which provide address or rooftop geocoding precision.

Request Details

Example Request Url
https://geodata.cdxtech.com/api/geolocate?key={key}&query={query}&format={format}

Description Required Default Value Example
key Authentication Key key=dd76pxfi4feydh4bz_dtrjyf6flu4-987asdjhajkd555usds28ad984yhz
query Single address or landmark name query=White House
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 query = "white house"
string format = "json";
HttpResponseMessage message = null;
using (HttpClient client = new HttpClient())
{
	client.BaseAddress = new Uri("https://geodata.cdxtech.com");
	StringBuilder url = new StringBuilder("/api/geolocate?");
	url.Append("key=").Append(key);
	url.Append("&query=").Append(query);
	url.Append("&format=").Append(format);
	message = client.GetAsync(url.ToString()).Result;
}



import requests

def get_geolocate(api_key, query, response_format="json"):
    """Fetch geolocation results using the API."""
    base_url = "https://geodata.cdxtech.com"
    endpoint = "/api/geolocate"
    url = f"{base_url}{endpoint}"
    params = {
        "key": api_key,
        "query": query,
        "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}"
    query = "white house"
    fmt = "json"
    data = get_geolocate(key, query, fmt)
    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_geolocate(
    api_key: &str,
    query: &str,
    response_format: &str,
) -> Result> {
    let client = reqwest::blocking::Client::new();
    let resp = client
        .get("https://geodata.cdxtech.com/api/geolocate")
        .query(&[
            ("key", api_key),
            ("query", query),
            ("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 query = "white house";
    let fmt = "json";

    match get_geolocate(api_key, query, fmt) {
        Ok(data) => println!("Response JSON:\n{}", serde_json::to_string_pretty(&data)?),
        Err(err) => eprintln!("Error fetching data: {}", err),
    }

    Ok(())
}



async function getGeolocate({ key, query, format = "json" }) {
    const baseUrl = "https://geodata.cdxtech.com";
    const endpoint = "/api/geolocate";
    const params = new URLSearchParams({ key, query, 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 query = "white house";
    const format = "json";
    try {
        const data = await getGeolocate({ key, query, format });
        console.log("Response:", data);
    } catch (err) {
        console.error("Error fetching data:", err);
    }
})();



Dim key As String = "{your-key}"
Dim query = "white house"
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/geolocate?")
	url.Append("key=").Append(key)
	url.Append("&query=").Append(query)
	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 query AS String
Dim format As String
key = "{your-key}"
query = "white house"
format = "json"
Client.BaseUrl = "https://geodata.cdxtech.com/api/"
Request.Method = WebMethod.HttpGet
Request.ResponseFormat = WebFormat.Json
Request.Resource = "geolocate?key={key}&query={query}&format={format}"
Request.AddUrlSegment "key", key
Request.AddUrlSegment "query", query
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": "GeoLocate",
	"url": "https://geodata.cdxtech.com/api/geolocate?key=e447cf4e-60c0-44aa-a24e-703a77e233f7&query=white%20house&format=json",
	"status": "Success",
	"tokenCharge": 2,
	"message": null,
	"totalResults": 5,
	"results": [{
		"formattedAddress": "White House, DC",
		"streetAddress": null,
		"city": "Washington",
		"county": "City of Washington",
		"state": "DC",
		"zipCode": null,
		"country": "United States",
		"latitude": 38.8973045349121,
		"longitude": -77.0365447998047,
		"confidence": "High"
	},
	{
		"formattedAddress": "Casablanca, Morocco",
		"streetAddress": null,
		"city": "Washington",
		"county": "City of Washington",
		"state": "DC",
		"zipCode": null,
		"country": "United States",
		"latitude": 38.8973045349121,
		"longitude": -77.0365447998047,
		"confidence": "High"
	},
	{
		"formattedAddress": "White House, VA",
		"streetAddress": null,
		"city": "Washington",
		"county": "City of Washington",
		"state": "DC",
		"zipCode": null,
		"country": "United States",
		"latitude": 38.8973045349121,
		"longitude": -77.0365447998047,
		"confidence": "High"
	},
	{
		"formattedAddress": "White House, TN",
		"streetAddress": null,
		"city": "Washington",
		"county": "City of Washington",
		"state": "DC",
		"zipCode": null,
		"country": "United States",
		"latitude": 38.8973045349121,
		"longitude": -77.0365447998047,
		"confidence": "High"
	},
	{
		"formattedAddress": "White House, VA",
		"streetAddress": null,
		"city": "Washington",
		"county": "City of Washington",
		"state": "DC",
		"zipCode": null,
		"country": "United States",
		"latitude": 38.8973045349121,
		"longitude": -77.0365447998047,
		"confidence": "High"
	}],
	"usage": {
		"used": 2607,
		"usedPercentage": 1.320715527,
		"remaining": 197393,
		"remainingPercentage": 98.679284473
	},
	"duration": 0.1547903,
	"timeStamp": "2017-07-24T10:13:47.3486183-04:00"
}



<Root>
  <Service>GeoLocate</Service>
  <Url>https://geodata.cdxtech.com/api/geolocate?key=e447cf4e-60c0-44aa-a24e-703a77e233f7&amp;query=white%20house&amp;format=xml</Url>
  <Status>Success</Status>
  <TokenCharge>2</TokenCharge>
  <Message />
  <TotalResults>5</TotalResults>
  <Results>
	<FormattedAddress>White House, DC</FormattedAddress>
	<StreetAddress />
	<City>Washington</City>
	<County>City of Washington</County>
	<State>DC</State>
	<ZipCode />
	<Country>United States</Country>
	<Latitude>38.8973045349121</Latitude>
	<Longitude>-77.0365447998047</Longitude>
	<Confidence>High</Confidence>
  </Results>
  <Results>
	<FormattedAddress>Casablanca, Morocco</FormattedAddress>
	<StreetAddress />
	<City>Washington</City>
	<County>City of Washington</County>
	<State>DC</State>
	<ZipCode />
	<Country>United States</Country>
	<Latitude>38.8973045349121</Latitude>
	<Longitude>-77.0365447998047</Longitude>
	<Confidence>High</Confidence>
  </Results>
  <Results>
	<FormattedAddress>White House, VA</FormattedAddress>
	<StreetAddress />
	<City>Washington</City>
	<County>City of Washington</County>
	<State>DC</State>
	<ZipCode />
	<Country>United States</Country>
	<Latitude>38.8973045349121</Latitude>
	<Longitude>-77.0365447998047</Longitude>
	<Confidence>High</Confidence>
  </Results>
  <Results>
	<FormattedAddress>White House, TN</FormattedAddress>
	<StreetAddress />
	<City>Washington</City>
	<County>City of Washington</County>
	<State>DC</State>
	<ZipCode />
	<Country>United States</Country>
	<Latitude>38.8973045349121</Latitude>
	<Longitude>-77.0365447998047</Longitude>
	<Confidence>High</Confidence>
  </Results>
  <Results>
	<FormattedAddress>White House, VA</FormattedAddress>
	<StreetAddress />
	<City>Washington</City>
	<County>City of Washington</County>
	<State>DC</State>
	<ZipCode />
	<Country>United States</Country>
	<Latitude>38.8973045349121</Latitude>
	<Longitude>-77.0365447998047</Longitude>
	<Confidence>High</Confidence>
  </Results>
  <Usage>
	<Used>2609</Used>
	<UsedPercentage>1.321742126</UsedPercentage>
	<Remaining>197391</Remaining>
	<RemainingPercentage>98.678257874</RemainingPercentage>
  </Usage>
  <Duration>0.12736709999999998</Duration>
  <TimeStamp>2017-07-24T10:13:48.6594513-04:00</TimeStamp>
</Root>