Skip to the content.

RealWeather API

The following is the full listing of the methods that you can call upon from your code.

getUsersWeather
getWeatherFromZip
getWeatherFromCityName
getWeatherFromLatLon
getWeatherFromCityID

Code lists

These are useful lists that you will come across using the API.

City ID list
Full weather code list
Short weather code list


API Details

getUsersWeather

Description:
This method is used to get the users local weather by looking up that lat/lon from the location services if it is a mobile device or from the IP lookup system if you have entered that API key in to the system.

Method:
getUsersWeather(Action<UserLocationData> successCallback)

Input parameters:

successCallback - A standard Unity Action callback for when the method completes. Use this to update your application with the new data.


getWeatherFromZip

Description:
This method is used to get the users local weather by looking it up via a city name. This will work internationally as long as a country code is passed in. If the city is not found an error will be returned in the log.

Method:
getWeatherFromZip(string zip, string country, Action successCallback)

Input parameters:

zip - The zip code to lookup.
country - The country that the zipcode exists in. Ex: US, CA, FR.
successCallback - A standard Unity Action callback for when the method completes. Use this to update your application with the new data.


getWeatherFromCityName

Description:
This method is used to get the users local weather by looking it up via their zip code. This will work internationally as long as a country code is passed in.

Method:
getWeatherFromCityName(string cityName, string country, Action successCallback)

Input parameters:

cityName - The city name to lookup.
country - The country that the zipcode exists in. Ex: US, CA, FR.
successCallback - A standard Unity Action callback for when the method completes. Use this to update your application with the new data.


getWeatherFromLatLon

Description:
This method is used to get the weather for a specific location using lat/lon. Lat must be in the range of -90 to 90 and Lon must be in the range of -180 to 180.

Method:
getWeatherFromLatLon(float lat, float lon, Action successCallback)

Input parameters:

lat - The latitude.
lon - The longitude.
successCallback - A standard Unity Action callback for when the method completes. Use this to update your application with the new data.


getWeatherFromCityID

Description:
This method is used to get the weather for a specific city based on the city IDs defined by the OpenMapWeather system. The full city list can be found here.

Method:
getWeatherFromLatLon(float lat, float lon, Action successCallback)

Input parameters:

lat - The latitude.
lon - The longitude.
successCallback - A standard Unity Action callback for when the method completes. Use this to update your application with the new data.


Code Lists

City Codes

If you want an unambiguous way to look up a specific city without room for error then the city ID is the safest way to go about that. There are two ways to go about finding the city ID:

  1. Download the full city ID list at http://bulk.openweathermap.org/sample/
  2. Use the OpenWeatherMap search system at https://openweathermap.org/find. The search system will provide you with the lat/lon of that city and if you click in to the city you can get the city ID from the URL.


Full weather codes

ID Meaning
200 thunderstorm with light rain
201 thunderstorm with rain
202 thunderstorm with heavy rain
210 light thunderstorm
211 thunderstorm
212 heavy thunderstorm
221 ragged thunderstorm
230 thunderstorm with light drizzle
231 thunderstorm with drizzle
232 thunderstorm with heavy drizzle

ID Meaning
300 light intensity drizzle
301 drizzle
302 heavy intensity drizzle
310 light intensity drizzle rain
311 drizzle rain
312 heavy intensity drizzle rain
313 shower rain and drizzle
314 heavy shower rain and drizzle
321 shower drizzle

ID Meaning
500 light rain
501 moderate rain
502 heavy intensity rain
503 very heavy rain
504 extreme rain
511 freezing rain
520 light intensity shower rain
521 shower rain
522 heavy intensity shower rain
531 ragged shower rain

ID Meaning
600 light snow
601 snow
602 heavy snow
611 sleet
612 shower sleet
615 light rain and snow
616 rain and snow
620 light shower snow
621 shower snow
622 heavy shower snow

ID Meaning
701 mist
711 smoke
721 haze
731 sand, dust whirls
741 fog
751 sand
761 dust
762 volcanic ash
771 squalls
781 tornado

ID Meaning
800 clear sky

ID Meaning
801 few clouds
802 scattered clouds
803 broken clouds
804 overcast clouds

Short weather codes

Often times when creating a weather function in an application or game the many detailed options for the types of weather are not needed. In this case you can use the basic version which simplifies that types of weather options down to the basic six.

ID Meaning
0 Clear skies
3 Rain of any amount or intensity
6 Snow of any amount or intensity
7 Haze or atmospheric conditions such as sand storms and smoke
8 Any type of cloudy conditions