×

OpenWeather
Meteorological Service

Dan Hart Speak to the Chief
Meteorologist Dan Hart and
his team!

You know where you are with the OpenWeather Geocoding API.

You know where you are with the OpenWeather Geocoding API.

Posted on 28 Feb 2022

The OpenWeather APIs use geographic coordinates to give our users the accuracy they require, however converting a user defined location into longitude and latitude is far from a straightforward process. 

The process of receiving accurate weather information starts with being able to specify the required location itself. 

OpenWeather have developed a deceptively simple and easy to use API that can be used in a wide variety of applications. Known as goocoding, it gives you the ability to convert any location name into geographical coordinates, and vice versa. 

Our API takes the name of any global location or zip code, and converts it into a list of coordinates (known as direct geocoding) as well as converting a geolocation into a list of place names (reverse geocoding). The size of the returned list can be limited if needed (for example London in the UK and London in the USA).

As our API is based on Nominatim database, we achieve excellent levels of accuracy, with local level city detail being achieved. We have  integrated our Gecoding API in our Weather app collection


Direct Geocoding:

Coordinates by location name

The following API call can be made:

http://api.openweathermap.org/geo/1.0/direct?q={city name},{state code},{country code}&limit={limit}&appid={API key}

With the following request parameters:

  • City name, state code (only for the US) and country code divided by comma. Please use ISO 3166 country codes.

  • Your unique API key (you can always find it on your account page under the "API key" tab)

  • Number of the locations in the API response (up to 5 results can be returned in the API response)

 

Coordinates by zip/post code

The following API call can be made:

http://api.openweathermap.org/geo/1.0/zip?zip={zip code},{country code}&appid={API key}

With the following request parameters:

  • Zip/post code and country code divided by comma. Please use ISO 3166 country codes.

  • Your unique API key (you can always find it on your account page under the "API key" tab)


Reverse Geocoding:

The following API call can be made:

http://api.openweathermap.org/geo/1.0/reverse?lat={lat}&lon={lon}&limit={limit}&appid={API key}

Field in the request:

  • Geographical coordinates (latitude, longitude)

  • Your unique API key (you can always find it on your account page under the "API key" tab)

  • Number of the location names in the API response (several results can be returned in the API response)

Fields in the response:

  • name Name of the found location

  • local_names

    • local_names.[language code] Name of the found location in different languages. The list of names can be different for different locations.

    • local_names.ascii Internal field

    • local_names.feature_name Internal field

  • lat Geographical coordinates of the found location (latitude)

  • lon Geographical coordinates of the found location (longitude)

  • country Country of the found location

  • state (where available) State of the found location.

Let this easy-to-use OpenWeather API help you with the often difficult task of Geocoding.


Further technical information on the OpenWeather Geocoding API can be found here.

Pricing and subscription details can be found here.

Technical support and details of how to start using the OpenWeather Geocoding API can be found here.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.