Coder Social home page Coder Social logo

openweather's Introduction

openweather โ€ƒ Latest Version

Openweather is an unofficial thin wrapper around OpenWeatherMaps API for requesting current and historical weather data


Useful links:

How to use

To request weather data a LocationSpecifier needs to be defined for the location of interest. The available methods of specifiying a location are:

  • CityAndCountryName ({city: "CITY_NAME", country: "COUNTRY_CODE"})
  • CityId (CITY_ID_CODE)
  • Coordinates ({lat: LATITUDE, lon: LONGITUDE})
  • ZipCode ({zip: "ZIP_CODE", country: "COUNTRY_CODE"})
  • BoundingBox ({lon_left: LEFT_LONGITUDE, lat_bottom: BOTTOM_LATITUDE, lon_right: RIGHT_LONGITUDE, lat_top: TOP_LATITUDE})
  • Circle ({lat: CENTER_LATITUDE, lon: CENTER_LONGITDE, count: NUMBER_OF_CITIES_OF_INTEREST})
  • CityIds ([CITY_ID_1, CITY_ID_2])

Once a LocationSpecifier has been created it can be used to querry any of available API endpoints:

  • get_current_weather
  • get_5_day_forecast
  • get_16_day_forecast
  • get_historical_data
  • get_accumulated_temperature_data
  • get_accumulated_precipitation_data
  • get_current_uv_index
  • get_forecast_uv_index
  • get_historical_uv_index

An example of querrying the current temperature in Minneapolis, MN:

extern crate openweather;

use openweather::LocationSpecifier;
static API_KEY: &str = "YOUR_API_KEY_HERE";

fn main() 
{
    let loc = LocationSpecifier::CityAndCountryName{city:"Minneapolis", country:"USA"};
    let weather = openweather::get_current_weather(loc, API_KEY).unwrap();
    println!("Right now in Minneapolis, MN it is {}K", weather.main.temp);
}

License

openweather is licensed under the MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

openweather's People

Contributors

broderickcarlin avatar caemor avatar nguiard avatar simeonschaub avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.