Geocode type

{
    "address": "790 Duane Avenue E, Sunnyvale, Santa Clara, CA, 94085, USA",
    "latitude": 37.3865321,
    "longitude": -122.01121455,
    "house_number": "790",
    "street": "Duane Avenue E",
    "street_name": "Duane",
    "street_type": "Avenue",
    "city": "Sunnyvale",
    "county": "Santa Clara",
    "state": "California",
    "state_code": "CA",
    "postal_code": "94085",
    "precision": "rooftop",
    "provider": "OpenAddresses",
    "ntk_geocode_time": 218
}

Attributes

addressstring

The address returned from provider

citystring
countystring
house_numberstring
latitudenumber
longitudenumber
ntk_geocode_timenumber 
postal_codestring
precisionstring
providerstring
statestring
state_codestring
streetstring
street_namestring
street_typestring

Geocode

GET/geo/geocodes

Parameters

addressstring(required*)

The unstructured address being searched (e.g. "1600 Pennsylvania Avenue, Washington, DC"). For addresses in the US, NetToolKit attempts to use its own proprietary address parsing logic to separate the different components. NetToolKit relies on OpenStreetMap to parse addresses outside of the US and landmark names (e.g. "Statue of Liberty").

* If you wish to rely on your own address parsing for an address that is in the US, you can specify the address as a structured address instead.
citystring(required*)

The city name of the structured address being searched.

* Required if unstructured address and zip code are not provided.
statestring(required*)

The state name of the structured address being searched.

* Required if unstructured address and zip code are not provided.
streetstring(required*)

The street component of the structured address being searched, including the house number (e.g. "1600 Pennsylvania Avenue").

* Required if unstructured address is not provided.
zipnumber(required*)

The zip code of the structured address being searched.

* Required if unstructured address, city and state are not provided.
country_codestring(optional)

An Alpha-2 country code to indicate the country of the accompanying address.

* Recommended: When the country of the address is known, NetToolKit recommends supplying this information because Nominatim may be used in certain cases. When an address ends with a two-character code, Nominatim gives priority to addresses that are in the country represented by that two-character code. For example, Nominatim interprets "San Francisco, CA" as a store named "San Francisco" in the country of Canada (represented by "CA"). Specifying "US" as the country code will cause Nominatim to interpret "San Francisco, CA" as the well-known city in California (also represented by "CA").
providerstring(optional)

The geocoding provider that is being queried.

Options:
  • "NetToolKit"
  • "OpenStreetMap"
  • "PostGIS"

Example 1: Specifying an unparsed address

Request

curl "https://api.nettoolkit.com/v1/geo/geocodes?address=790%20E%20Duane%20Ave%2C%20Sunnyvale%2C%20CA%2094085" \
-H "X-NTK-KEY: $YOUR_KEY_HERE"

Response

{
    "code": 1000,
    "http_status_code": 200,
    "query": {
        "address_query": "790 E Duane Ave, Sunnyvale, CA 94085"
    },
    "results": [
        {
            "address": "790 E Duane Avenue, Sunnyvale, CA, 94085, US",
            "latitude": 37.3865321,
            "longitude": -122.01121455,
            "house_number": "790",
            "street": "E Duane Avenue",
            "street_name": "Duane",
            "street_type": "Avenue",
            "city": "Sunnyvale",
            "county": "Santa Clara",
            "state": "California",
            "state_code": "CA",
            "country": "United States of America",
            "postcode": "94085",
            "postal_code": "94085",
            "precision": "rooftop",
            "provider": "OpenAddresses",
            "ntk_geocode_time": 266
        }
    ]
}

Example 2: Specifying a US address as separate components

Request

curl "https://api.nettoolkit.com/v1/geo/geocodes?street=790%20E%20Duane%20Ave&city=Sunnyvale&state=CA&zip=94085" \
-H "X-NTK-KEY: $YOUR_KEY_HERE"

Response

{
    "code": 1000,
    "query": {
        "street": "790 E Duane Ave",
        "city": "Sunnyvale",
        "state": "CA",
        "zip": "94085"
    },
    "results": [
        {
            "address": "790 E Duane Avenue, Sunnyvale, CA, 94085, US",
            "latitude": 37.3865321,
            "longitude": -122.01121455,
            "house_number": "790",
            "street": "E Duane Avenue",
            "street_name": "Duane",
            "street_type": "Avenue",
            "city": "Sunnyvale",
            "county": "Santa Clara",
            "state": "California",
            "state_code": "CA",
            "country": "United States of America",
            "postcode": "94085",
            "postal_code": "94085",
            "precision": "rooftop",
            "provider": "OpenAddresses",
            "ntk_geocode_time": 372,
            "type": "geocode"
        }
    ]
}

Example 3: Specifying OpenStreetMap as the geocoding provider

Request

curl "https://api.nettoolkit.com/v1/geo/geocodes?provider=OpenStreetMap&address=790%20E%20Duane%20Ave%2C%20Sunnyvale%2C%20CA%2094085" \
-H "X-NTK-KEY: $YOUR_KEY_HERE"

Response

{
    "code": 1000,
    "http_status_code": 200,
    "query": {
        "address_query": "790 E Duane Ave, Sunnyvale, CA 94085"
    },
    "results": [
        {
            "address": "Duane Avenue, Sunnyvale, Santa Clara County, California, 94088-3453, United States of America",
            "latitude": 37.386908,
            "longitude": -121.996928,
            "house_number": "790",
            "street_name": "Duane",
            "street_type": "Avenue",
            "city": "Sunnyvale",
            "state": "California",
            "state_code": "CA",
            "precision": "street_segment",
            "provider": "OpenStreetMap",
            "provider_geocode_time": 40
        },
        {
            "address": "Duane Avenue, Sunnyvale, Santa Clara County, California, 94088-3453, United States of America",
            "latitude": 37.386908,
            "longitude": -121.996928,
            "house_number": "790",
            "street_name": "Duane",
            "street_type": "Avenue",
            "city": "Sunnyvale",
            "state": "California",
            "state_code": "CA",
            "precision": "street_segment",
            "provider": "OpenStreetMap",
            "provider_geocode_time": 40
        }
    ]
}