Giter VIP home page Giter VIP logo

openweathermap-java-api's Introduction

openweathermap-java-api Build Status codecov

To use the OpenweatherMap API, you need to obtain an API key. Sign up here.

Features

Current weather queries

Call current weather data for one location

  • By city name
  • By city ID
  • By ZIP code
  • By geographic coordinates

Call current weather data for several cities

  • Cities within a rectangle zone
  • Cities in cycle
  • Call for several city IDs

Forecast queries

Call 5 day / 3 hour forecast data

  • By city name
  • By city ID
  • By geographic coordinates

Call 16 day / daily forecast data

  • By city name
  • By city ID
  • By geographic coordinates

Supported Languages

ENGLISH("en"), RUSSIAN("ru"), ITALIAN("it"), SPANISH("sp"), UKRAINIAN("ua"), GERMAN("de"), PORTUGUESE("pt"), ROMANIAN("ro"), POLISH("pl"), FINNISH("fi"), DUTCH("nl"), FRENCH("fr"), BULGARIAN("bg"), SWEDISH("sv"), CHINESE_TRADITIONAL("zh_tw"), CHINESE_SIMPLIFIED("zh_cn"), TURKISH("tr"), CROATIAN("hr"), CATALAN("ca");

Supported formats

  • JSON (result as String or as WeatherInfo object)
  • XML (result only as String now)
  • HTML (result only as String)

Supported Units format

  • Standard
  • Metric
  • Imperial

More information about weather parameters and unit can be found here.

Examples

Take a look at examples module

openweathermap-java-api's People

Contributors

xsavikx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

openweathermap-java-api's Issues

Not available on Maven

Hi, is there a maven dependency I can add to my maven Java project to get this code? If not, is there a different way that I can use the existing donwloaded zip file in my maven project?

Thank you.

cannot build

i'm trying to get the jars to get in my project and when i'm running the graddle script for building i'm getting:
11:37:02 AM: Executing task...

Could not determine java version from '11.0.2'.
11:37:04 AM: Task execution finished.

Failed to read artifact descriptor for org.openweathermap.java-api:api-core:jar:1.2.3

Hi !
the following error appeared on my project some days ago:

Could not resolve dependencies for project com.xxx.yyy:jar:0.1-SNAPSHOT: Failed to collect dependencies at org.openweathermap.java-api:api-core:jar:1.2.3: Failed to read artifact descriptor for org.openweathermap.java-api:api-core:jar:1.2.3: Could not transfer artifact org.openweathermap.java-api:api-core:pom:1.2.3 from/to bintray-xsavikx-openweathermap-java-api (https://dl.bintray.com/xsavikx/openweathermap-java-api)

to confirm, when I try to manually download the jar https://jcenter.bintray.com/org/openweathermap/java-api/api-core/1.2.3/api-core-1.2.3.jar at https://mvnrepository.com/artifact/org.openweathermap.java-api/api-core/1.2.3 it fails with error 403.

could you fix this issue please ?

best regards,
kendy

Model City is missing crucial field

Model org.openweathermap.api.model.forecast.City is missing a crucial field 'timezone' returned from api openweathermap.

Since api returns date and time in UTC timezone, you'll have to make some workaround in order to get localdatetime from coordinates (and use external api or external dependencies)...

Timezone support for current weather response

Here is the announcement:
https://openweather.co.uk/blog/post/we-have-integrated-time-zones-our-weather-api-products

And diff:

diff --git a/api-model/src/main/java/org/openweathermap/api/model/currentweather/CurrentWeather.java b/api-model/src/main/java/org/openweathermap/api/model/currentweather/CurrentWeather.java
index 4468b40..a893495 100644
--- a/api-model/src/main/java/org/openweathermap/api/model/currentweather/CurrentWeather.java
+++ b/api-model/src/main/java/org/openweathermap/api/model/currentweather/CurrentWeather.java
@@ -28,4 +28,5 @@ public class CurrentWeather extends AbstractWeatherInformation {
     private String visibility;
     @SerializedName("sys")
     private SystemParameters systemParameters;
+    private long timezone; // Shift in seconds from UTC
 }

Compilation breaks when compiling release build (with proguard) because of lombok

It's always failing in :app:transformClassesAndResourcesWithProguardForStagingRelease
Adding -keep class lombok.** { *; } in the proguard file did not help.

11:15:06.286 [ERROR] [system.err] Warning: there were 728 unresolved references to classes or interfaces.
11:15:06.286 [ERROR] [system.err] You may need to add missing library jars or update their versions.
11:15:06.286 [ERROR] [system.err] If your code works fine without the missing classes, you can suppress
11:15:06.286 [ERROR] [system.err] the warnings with '-dontwarn' options.
11:15:06.286 [ERROR] [system.err] (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
11:15:06.286 [ERROR] [system.err] Warning: there were 2 unresolved references to program class members.
11:15:06.286 [ERROR] [system.err] Your input classes appear to be inconsistent.
11:15:06.286 [ERROR] [system.err] You may need to recompile the code.
11:15:06.286 [ERROR] [system.err] (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)

in the attached file you can find all the warnings about the classes and interfaces that cannot be found.
lombok_warnings.txt

Am I importing your library incorrectly?

In my build.gradle file I imported the api like this:
dependencies {
...
api 'org.openweathermap.java-api:api-core:1.0'
}

Edit: by using -dontwarn lombok.** I can build the apk, but then at runtime when querying daily forecasts, the DailyForecast.getWeather() method returns null. This does not happen with the debug build or by not using proguard in the release build.

ISOStringDateTypeAdapter sets wrong timezone and uses SimpleDateFormat

Openweather API states that they return date-time of calculation in UTC timezone
https://openweathermap.org/api/hourly-forecast#JSON

list.dt_txt Data/time of calculation, UTC

However, when deserialization takes place, ISOStringDateTypeAdapter is using rough 'new SimpleDateFormat(ISO_DATE_FORMAT)' without timezone which results in system default timezone.
Also, I don't think that using SimpleDateFormat is a good solution for parallel operation. I suggest using FastDateFormat of ThreadLocal for SDF if you don't want additional dependencies for you lib.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.