Geocoding

Example Request URL

curl -s -H "X-NTK-KEY: $your_key_here" \
"https://api.nettoolkit.com/v1/geo/geocodes?address=790+E+Duane+Ave,+Sunnyvale,+CA+94085"

Resource Information

Response format
JSON
Authentication
Yes (Requires Key)

Parameters

provider (Optional)
Optionally specify a geocoding provider. The default value is "NetToolKit", which could return values from OpenAddresses, OpenStreetMap, PostGIS, or from another source. You can restrict the provider to be "OpenStreetMap" or "PostGIS".
address
The query string being searched. If you wish to rely on your own address parsing, you can alternatively specify the address with these components:
- street
The street part of the address including house number, street direction, and street designation
- city
The city name
- state
The state name
- zip
The zip code

Sample JSON output

This is a simple request where the entire address is specified as one parameter.
curl -s -H "X-NTK-KEY: $your_key_here" \
"https://api.nettoolkit.com/v1/geo/geocodes?address=790+E+Duane+Ave,+Sunnyvale,+CA+94085"
{
  "code":1000,
  "http_status_code":200,
  "query":{
    "address_query":"790 E Duane Ave, Sunnyvale, CA 94085"
  },
  "results":[{
    "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
  }]
}
This is a request where the address is split into multiple components and the key is specified in as a URL parameter.
curl -s -H "X-NTK-KEY: $your_key_here" \
"https://api.nettoolkit.com/v1/geo/geocodes?street=790+E+Duane+Ave&city=Sunnyvale&state=CA&zip=94085"
{
  "code":1000,
  "http_status_code":200,
  "query":{
    "street":"790 E Duane Ave",
    "city":"Sunnyvale",
    "state":"CA",
    "zip":"94085"
  },
  "results":[{
    "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":244
  }]
}
This is a request that uses OpenStreetMap geocoding.
curl -s -H "X-NTK-KEY: $your_key_here" \
"https://api.nettoolkit.com/v1/geo/geocodes?provider=OpenStreetMap&address=790+E+Duane+Ave,+Sunnyvale,+CA+94085"
{
  "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
  }]
}