public class OWM
Starting point for this lib. If you're new to this API, start from this class.
Lets you access data from OpenWeatherMap.org using its Weather APIs (Free).
Sample code in Java:
OWM owm = new OWM("your-free-api-key");
Sample code in Kotlin:
val owm: OWM = OWM("your-free-api-key")
| Modifier and Type | Class and Description |
|---|---|
static class |
OWM.Companion |
| Modifier and Type | Field and Description |
|---|---|
static OWM.Companion |
Companion |
| Constructor and Description |
|---|
OWM(java.lang.String apiKey)
Constructor
|
OWM(java.lang.String apiKey,
java.lang.String baseUrl) |
| Modifier and Type | Method and Description |
|---|---|
AirPollution |
airPollutionByCoords(double latitude,
double longitude,
java.lang.String dateTime) |
AirPollution |
airPollutionByCoords(double latitude,
double longitude,
java.util.Date dateTime) |
retrofit2.Retrofit |
createRetrofit4OthersInstance(java.net.Proxy proxy)
Init Retrofit for getting other data from OpenWeatherMap.org
|
retrofit2.Retrofit |
createRetrofit4PollutionInstance(java.net.Proxy proxy)
Init Retrofit for getting pollution data from OpenWeatherMap.org
|
retrofit2.Retrofit |
createRetrofit4WeatherInstance(java.net.Proxy proxy)
Init Retrofit for getting weather data from OpenWeatherMap.org
|
AirPollution |
currentAirPollutionByCoords(double latitude,
double longitude) |
CurrentUVIndex |
currentUVIndexByCoords(double latitude,
double longitude) |
CurrentWeather |
currentWeatherByCityId(int cityId) |
CurrentWeather |
currentWeatherByCityName(java.lang.String cityName) |
CurrentWeather |
currentWeatherByCityName(java.lang.String cityName,
OWM.Country countryCode) |
CurrentWeather |
currentWeatherByCoords(double latitude,
double longitude) |
CurrentWeather |
currentWeatherByZipCode(int zipCode) |
CurrentWeather |
currentWeatherByZipCode(int zipCode,
OWM.Country countryCode) |
java.util.List<net.aksingh.owmjapis.model.DailyUVIndexForecast> |
dailyUVIndexForecastByCoords(double latitude,
double longitude) |
DailyWeatherForecast |
dailyWeatherForecastByCityId(int cityId) |
DailyWeatherForecast |
dailyWeatherForecastByCityId(int cityId,
int count) |
DailyWeatherForecast |
dailyWeatherForecastByCityName(java.lang.String cityName) |
DailyWeatherForecast |
dailyWeatherForecastByCityName(java.lang.String cityName,
int count) |
DailyWeatherForecast |
dailyWeatherForecastByCityName(java.lang.String cityName,
OWM.Country countryCode) |
DailyWeatherForecast |
dailyWeatherForecastByCityName(java.lang.String cityName,
OWM.Country countryCode,
int count) |
DailyWeatherForecast |
dailyWeatherForecastByCoords(double latitude,
double longitude) |
DailyWeatherForecast |
dailyWeatherForecastByCoords(double latitude,
double longitude,
int count) |
DailyWeatherForecast |
dailyWeatherForecastByZipCode(int zipCode) |
DailyWeatherForecast |
dailyWeatherForecastByZipCode(int zipCode,
int count) |
DailyWeatherForecast |
dailyWeatherForecastByZipCode(int zipCode,
OWM.Country countryCode) |
DailyWeatherForecast |
dailyWeatherForecastByZipCode(int zipCode,
OWM.Country countryCode,
int count) |
OWM.Accuracy |
getAccuracy() |
java.lang.String |
getApiKey() |
java.lang.String |
getBaseUrl() |
OWM.Language |
getLanguage() |
java.net.Proxy |
getProxy() |
retrofit2.Retrofit |
getRetrofit4others() |
retrofit2.Retrofit |
getRetrofit4pollution() |
retrofit2.Retrofit |
getRetrofit4weather() |
OWM.Unit |
getUnit() |
java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> |
historicalUVIndexByCoords(double latitude,
double longitude,
int count,
long startTime,
long endTime) |
java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> |
historicalUVIndexByCoords(double latitude,
double longitude,
int count,
java.util.Date startTime,
java.util.Date endTime) |
java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> |
historicalUVIndexByCoords(double latitude,
double longitude,
long startTime,
long endTime) |
java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> |
historicalUVIndexByCoords(double latitude,
double longitude,
java.util.Date startTime,
java.util.Date endTime) |
HourlyWeatherForecast |
hourlyWeatherForecastByCityId(int cityId) |
HourlyWeatherForecast |
hourlyWeatherForecastByCityName(java.lang.String cityName) |
HourlyWeatherForecast |
hourlyWeatherForecastByCityName(java.lang.String cityName,
OWM.Country countryCode) |
HourlyWeatherForecast |
hourlyWeatherForecastByCoords(double latitude,
double longitude) |
HourlyWeatherForecast |
hourlyWeatherForecastByZipCode(int zipCode) |
HourlyWeatherForecast |
hourlyWeatherForecastByZipCode(int zipCode,
OWM.Country countryCode) |
void |
resetProxy()
Reset proxy to system's proxy for getting data from OpenWeatherMap.org
|
void |
setAccuracy(OWM.Accuracy value) |
void |
setApiKey(java.lang.String value) |
void |
setBaseUrl(java.lang.String p) |
void |
setLanguage(OWM.Language value) |
OWM |
setNoProxy()
Remove proxy (i.e., direct connection) for getting data from OpenWeatherMap.org
|
void |
setProxy(java.net.Proxy value) |
OWM |
setProxy(java.net.Proxy proxy,
java.lang.String user,
java.lang.String pass)
Set authenticated proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(java.lang.String host,
int port)
Set HTTP proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(java.lang.String host,
int port,
java.net.Proxy.Type type)
Set proxy of any type for getting data from OpenWeatherMap.org
|
OWM |
setProxy(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pass)
Set authenticated HTTP proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(java.lang.String host,
int port,
java.lang.String user,
java.lang.String pass,
java.net.Proxy.Type type)
Set authenticated proxy of any type for getting data from OpenWeatherMap.org
|
void |
setRetrofit4others(retrofit2.Retrofit p) |
void |
setRetrofit4pollution(retrofit2.Retrofit p) |
void |
setRetrofit4weather(retrofit2.Retrofit p) |
void |
setUnit(OWM.Unit value) |
public static OWM.Companion Companion
public OWM(java.lang.String apiKey)
Constructor
Defaults: Search accuracy is set to like Defaults: Unit is set to standard Defaults: Language is set to English Defaults: Proxy is set to system's proxy
apiKey - API key (free) from OpenWeatherMap.orgpublic OWM(java.lang.String apiKey,
java.lang.String baseUrl)
public retrofit2.Retrofit getRetrofit4others()
public void setRetrofit4others(retrofit2.Retrofit p)
public retrofit2.Retrofit getRetrofit4pollution()
public void setRetrofit4pollution(retrofit2.Retrofit p)
public retrofit2.Retrofit getRetrofit4weather()
public void setRetrofit4weather(retrofit2.Retrofit p)
public java.lang.String getBaseUrl()
public void setBaseUrl(java.lang.String p)
public OWM.Accuracy getAccuracy()
public void setAccuracy(OWM.Accuracy value)
public java.lang.String getApiKey()
public void setApiKey(java.lang.String value)
public OWM.Language getLanguage()
public void setLanguage(OWM.Language value)
public java.net.Proxy getProxy()
public void setProxy(java.net.Proxy value)
public OWM.Unit getUnit()
public void setUnit(OWM.Unit value)
public OWM setProxy(java.net.Proxy proxy, java.lang.String user, java.lang.String pass)
Set authenticated proxy for getting data from OpenWeatherMap.org
proxy - Proxyuser - User name for the proxypass - Password for the proxypublic OWM setProxy(java.lang.String host, int port)
Set HTTP proxy for getting data from OpenWeatherMap.org
host - Host address of the proxyport - Port address of the proxypublic OWM setProxy(java.lang.String host, int port, java.net.Proxy.Type type)
Set proxy of any type for getting data from OpenWeatherMap.org
host - Host address of the proxyport - Port address of the proxytype - Type of the proxypublic OWM setProxy(java.lang.String host, int port, java.lang.String user, java.lang.String pass)
Set authenticated HTTP proxy for getting data from OpenWeatherMap.org
host - Host address of the proxyport - Port address of the proxyuser - User name for the proxy if requiredpass - Password for the proxy if requiredpublic OWM setProxy(java.lang.String host, int port, java.lang.String user, java.lang.String pass, java.net.Proxy.Type type)
Set authenticated proxy of any type for getting data from OpenWeatherMap.org
host - Host address of the proxyport - Port address of the proxyuser - User name for the proxy if requiredpass - Password for the proxy if requiredtype - Type of the proxypublic OWM setNoProxy()
Remove proxy (i.e., direct connection) for getting data from OpenWeatherMap.org
public void resetProxy()
Reset proxy to system's proxy for getting data from OpenWeatherMap.org
public CurrentWeather currentWeatherByCityName(java.lang.String cityName)
public CurrentWeather currentWeatherByCityName(java.lang.String cityName, OWM.Country countryCode)
public CurrentWeather currentWeatherByCityId(int cityId)
public CurrentWeather currentWeatherByCoords(double latitude, double longitude)
public CurrentWeather currentWeatherByZipCode(int zipCode)
public CurrentWeather currentWeatherByZipCode(int zipCode, OWM.Country countryCode)
public HourlyWeatherForecast hourlyWeatherForecastByCityName(java.lang.String cityName)
public HourlyWeatherForecast hourlyWeatherForecastByCityName(java.lang.String cityName, OWM.Country countryCode)
public HourlyWeatherForecast hourlyWeatherForecastByCityId(int cityId)
public HourlyWeatherForecast hourlyWeatherForecastByCoords(double latitude, double longitude)
public HourlyWeatherForecast hourlyWeatherForecastByZipCode(int zipCode)
public HourlyWeatherForecast hourlyWeatherForecastByZipCode(int zipCode, OWM.Country countryCode)
public DailyWeatherForecast dailyWeatherForecastByCityName(java.lang.String cityName)
public DailyWeatherForecast dailyWeatherForecastByCityName(java.lang.String cityName, int count)
public DailyWeatherForecast dailyWeatherForecastByCityName(java.lang.String cityName, OWM.Country countryCode)
public DailyWeatherForecast dailyWeatherForecastByCityName(java.lang.String cityName, OWM.Country countryCode, int count)
public DailyWeatherForecast dailyWeatherForecastByCityId(int cityId)
public DailyWeatherForecast dailyWeatherForecastByCityId(int cityId, int count)
public DailyWeatherForecast dailyWeatherForecastByCoords(double latitude, double longitude)
public DailyWeatherForecast dailyWeatherForecastByCoords(double latitude, double longitude, int count)
public DailyWeatherForecast dailyWeatherForecastByZipCode(int zipCode)
public DailyWeatherForecast dailyWeatherForecastByZipCode(int zipCode, int count)
public DailyWeatherForecast dailyWeatherForecastByZipCode(int zipCode, OWM.Country countryCode)
public DailyWeatherForecast dailyWeatherForecastByZipCode(int zipCode, OWM.Country countryCode, int count)
public CurrentUVIndex currentUVIndexByCoords(double latitude, double longitude)
public java.util.List<net.aksingh.owmjapis.model.DailyUVIndexForecast> dailyUVIndexForecastByCoords(double latitude,
double longitude)
public java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> historicalUVIndexByCoords(double latitude,
double longitude,
int count,
long startTime,
long endTime)
public java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> historicalUVIndexByCoords(double latitude,
double longitude,
int count,
java.util.Date startTime,
java.util.Date endTime)
public java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> historicalUVIndexByCoords(double latitude,
double longitude,
long startTime,
long endTime)
public java.util.List<net.aksingh.owmjapis.model.HistoricalUVIndex> historicalUVIndexByCoords(double latitude,
double longitude,
java.util.Date startTime,
java.util.Date endTime)
public AirPollution airPollutionByCoords(double latitude, double longitude, java.lang.String dateTime)
public AirPollution airPollutionByCoords(double latitude, double longitude, java.util.Date dateTime)
public AirPollution currentAirPollutionByCoords(double latitude, double longitude)
public retrofit2.Retrofit createRetrofit4WeatherInstance(java.net.Proxy proxy)
Init Retrofit for getting weather data from OpenWeatherMap.org
proxy - Proxypublic retrofit2.Retrofit createRetrofit4PollutionInstance(java.net.Proxy proxy)
Init Retrofit for getting pollution data from OpenWeatherMap.org
proxy - Proxypublic retrofit2.Retrofit createRetrofit4OthersInstance(java.net.Proxy proxy)
Init Retrofit for getting other data from OpenWeatherMap.org
proxy - Proxy