Coder Social home page Coder Social logo

shadowxpa / xpa-weather Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.43 MB

The typical Weather app using OpenWeatherMap and Geocoding APIs

License: MIT License

Java 59.35% CSS 1.87% JavaScript 7.76% HTML 31.01%
api geocoding-api java javascript openweathermap-api spring-boot thymeleaf bootstrap jquery

xpa-weather's Introduction

XPA Weather

The typical Weather app using OpenWeatherMap and Geocoding APIs.

The web application

Main page

Main page

The application lets you insert your weather and geocoding API keys in their respective fields. After you have inserted the keys, you can type in a location, or use the Use my location button to get your address automatically. Then simply get the weather.
You will see the location, the current weather, and the forecast for the next 5 days with 3-hour steps.
This application supports both English and Portuguese languages.

The API

Get weather

GET /api/v1/weather?q={location}&geo-api-key={geocodingApiKey}&weather-api-key={weatherApiKey}&units={unitsOfMeasurement}&lang={language}

Gets the weather for a determined location.
q, geo-api-key, and weather-api-key are all mandatory fields, units, and lang are optional fields.
The default value for units is metric, and it only accepts metric or imperial.

Example response
{
  "coordinates": {
    "latitude": 40.7127281,
    "longitude": -74.0060152,
    "location": "New York, United States"
  },
  "location": "New York",
  "units": "IMPERIAL",
  "condition": "Clear",
  "description": "clear sky",
  "icon": "01d",
  "temperature": 81.99,
  "feelsLike": 81.93,
  "pressureSeaLevel": 1013,
  "pressureGroundLevel": 1012,
  "humidity": 44,
  "cloudiness": 0,
  "windSpeed": 13.8,
  "windDirection": 270,
  "visibility": 10000,
  "countryCode": "US",
  "sunrise": 1723370576,
  "sunset": 1723420771,
  "datetime": 1723409793,
  "timezone": -14400,
  "forecastList": [
    {
      "condition": "Clear",
      "description": "clear sky",
      "icon": "01n",
      "temperature": 81.46,
      "feelsLike": 81.34,
      "pressureSeaLevel": 1013,
      "pressureGroundLevel": 1012,
      "humidity": 43,
      "cloudiness": 9,
      "windSpeed": 11.68,
      "windDirection": 261,
      "visibility": 10000,
      "precipitation": 0,
      "datetime": 1723420800,
      "timezone": -14400
    },
    {
      "condition": "Clouds",
      "description": "scattered clouds",
      "icon": "03n",
      "temperature": 78.1,
      "feelsLike": 77.86,
      "pressureSeaLevel": 1014,
      "pressureGroundLevel": 1013,
      "humidity": 48,
      "cloudiness": 25,
      "windSpeed": 9.78,
      "windDirection": 284,
      "visibility": 10000,
      "precipitation": 0,
      "datetime": 1723431600,
      "timezone": -14400
    },
    ...
    {
      "condition": "Clear",
      "description": "clear sky",
      "icon": "01d",
      "temperature": 80.42,
      "feelsLike": 80.98,
      "pressureSeaLevel": 1017,
      "pressureGroundLevel": 1015,
      "humidity": 48,
      "cloudiness": 9,
      "windSpeed": 12.48,
      "windDirection": 163,
      "visibility": 10000,
      "precipitation": 0,
      "datetime": 1723842000,
      "timezone": -14400
    }
  ]
}

Get address

GET /api/v1/geocoding?lat={latitude}&lon={longitude}&geo-api-key={geocodingApiKey}

Gets the address given the latitude and longitude values.
All fields are mandatory.

Example response
{
    "address": "New York City Hall, 260, Broadway, Lower Manhattan, Manhattan Community Board 1, Manhattan, New York County, New York, 10000, United States"
}

Running the application

Head to the Releases tab and download the latest version available.
To run the application simply use java -jar weather-{version}.jar in the console.

You can also run it from your IDE by running the main function...

Open a browser window and head to localhost:8080 to start using the web application.
You will need an OpenWeatherMap API key and a Geocoding API key.
Create an account with both services to get a key (it's free).
Insert each key in their respective text inputs. If you do not want to keep inserting the keys all the time press the save button. It will save your keys in the browser's local storage.
Insert a location, and get the weather, provided by OpenWeatherMap.

xpa-weather's People

Contributors

shadowxpa avatar

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.