Geocode

Reverse-geocode a coordinate to a location.

Changed on

Resolves a (lat, lon) coordinate into a city / nearest-city / state / county / IANA timezone tuple. Coverage is the 50 US states and DC; other points return 404 outside-coverage with next_steps.

Caching

Successful responses carry Cache-Control: private, max-age=86400. The underlying place-name <-> timezone mapping changes on the order of years; clients should treat this as a long-term cache. The exception is a temporarily degraded or fallback answer, which is sent with Cache-Control: no-store so that no cache keeps it.

private means your own client may store the response for the full max-age, but shared caches (CDNs, proxies) must not: every request on a partner key is metered and rate-limited individually, so it has to reach the origin. The freshness budget is unchanged either way.

Auth

Standard sw-api Bearer auth applies.

get/v1/geocode/reverse

Request

  • Base URL
    https://api.smarterweather.com
  • Auth
    HTTP bearer

Query parameters

lat, number double required

Latitude in decimal degrees, range [-90, 90].

lon, number double required

Longitude in decimal degrees, range [-180, 180].

include, 'boundaries'

boundaries adds the containing-boundary ids of the exact point (boundaries): per reference-layer product (us_states, us_counties, nws_zones, nws_offices, ...), the ids an area reference takes. Read for the point itself, never a neighbour's cached answer.

Response

Resolved location metadata.

ReverseGeocodeResponse required

Resolved place metadata for a (lat, lon) query against GET /v1/geocode/reverse. All fields are best-effort: city is populated when the coordinate falls inside a populated-place polygon; nearest_city is populated when the coordinate is outside any city polygon but within the resolution radius of one. state carries the canonical NWS region label.

Forward-compat: additional fields may appear in this object without a sw-api release.

city, string

Populated-place name when the query coordinate falls inside a city polygon. Empty when only nearest_city is set.

nearest_city, string

Closest populated-place name when the query coordinate is outside any city polygon. Empty when city is set.

state, string

Canonical NWS state / region label (e.g. "Illinois", "Puerto Rico").

county, string

County or equivalent admin-2 area, when available.

timezone, string

IANA timezone identifier covering the query coordinate.

boundaries, object

With include=boundaries: the containing-boundary ids per reference-layer product id, each an id an area reference takes (area[product]=us_counties&area[feature_id]=17031). Absent when the lookup failed; the response is then Cache-Control: no-store.

Example response

{
  "city": "Chicago",
  "nearest_city": "Naperville",
  "state": "Illinois",
  "county": "Cook",
  "timezone": "America/Chicago",
  "boundaries": {
    "us_states": [
      "IL"
    ],
    "us_counties": [
      "17031"
    ],
    "nws_zones": [
      "forecast/ILZ014",
      "county/ILC031",
      "fire/ILZ014"
    ],
    "nws_offices": [
      "LOT"
    ]
  }
}

Changes

    • info

      added the optional property allOf[#/components/schemas/Problem]/alternatives to the response with the status

    • info

      added the optional property alternatives to the response with the status

    • info

      added the optional property alternatives to the response with the status

    7 more changes in this revision