Utility - Geocoding API

This API accepts a supported location and returns a latitude, and longitude.

All parameters should be supplied to the Weather API as query string parameters.

Note: This API returns a lat/lon given a supported city, postal code, or station ID. Most populated cities/postal codes are supported. However, this API is not intended to supplant the need for a dedicated geocoding service or provide address level geocoding. If more precise or robust geocoding is required for your application, we recommend using a dedicated geocoding service.

Base URL

HTTP: http://api.weatherbit.io/v2.0/geocode
HTTPS: https://api.weatherbit.io/v2.0/geocode
Supported Methods: GET

Request Parameters

key=[key] (REQUIRED)
  • key - Your API Key.

API Endpoints

Description Required Parameters Example(s)
Geocode by city name city, state(optional), country (optional)
  • &city=Raleigh&country=US
  • &city=Raleigh,NC
  • &city=Raleigh,North+Carolina
Geocode by postal code postal_code, country (optional) &postal_code=27601&country=US
Geocode by city id's city_id &city_id=8953360
Geocode by ICAO or station id station &station=KRDU

Example Request:

https://api.weatherbit.io/v2.0/geocode?postal_code=98104&country=US&key=API_KEY

Example Response (JSON):


            {
                "name": "King",
                "country_code": "US",
                "geo_id": "98104-US",
                "lat": 47.6036,
                "lon": -122.3256,
                "state_code": "WA",
                "timezone": "America/Los_Angeles"
            }
        

Field Decriptions:

  • name: Name of city, or postal code. (For station, this will return nearest city/town).
  • country_code: Country Code
  • geo_id: Geo ID - internal identifier of request
  • lat: Latitude
  • lon: Longitude
  • state_code: State Code
  • timezone: Timezone