Giter Site home page Giter Site logo

openweathermap-essentials's Introduction

OpenWeatherMap Essentials

Receive only the essential data back from the OpenWeatherMap API in an easy-to-navigate Weather object.

Weather {
  cloudiness: 90,
  sun: { 
    rise: '7:07:21',
    set: '16:51: 6'
  },
  location: {
    city: 'San Francisco',
    country: 'US',
    timezone: -28800
  },
  temp: {
    current: 55.8,
    min: 51.8,
    max: 60.01
  },
  air: {
    humidity: 82,
    pressure: 1018
  },
  type: {
    description: 'Rain',
    detailedDescription: 'light rain'
  },
  wind: {
    direction: 'NE',
    speed: 3
  },
  zip: 94108,
  apiKey: 'YOUR_KEY_HERE',
  units: 'imperial'
}

Getting Started

Create a new Weather object, passing in options in an object.

Options include apiKey (string), zip (number), and an optional units argument.

The units option accepts "imperial", "standard", or "metric" but will default to "imperial".

const weather = new Weather({ apiKey: 'YOUR_KEY_HERE', zip: 94108, units: 'imperial' })

Interpreting Data

Cloudiness

cloudiness returns the percentage of cloudiness (number)

Sun

sun.rise and sun.set return a formatted time string in the timezone local to the zip code (string)

Location

location.city returns the city name belonging to the zip code (string)

location.country returns the country name belonging to the zip code (string)

location.timezone returns the millisecond offset between your computer's time and the time local to the zip code (number)

Temp

temp.current returns the current temperature in the specified zip code (number)

temp.min returns the minimum temperature in the specified zip code (number)

temp.max returns the maximum temperature in the specified zip code (number)

Air

air.humidity returns the humidity percentage in the zip code (number)

air.pressure returns the atmospheric pressure in the zip code in hPa (number)

Type

type.description returns a short description of the weather in a zip code (string)

type.detailedDescription returns a long description of the weather in a zip code (string)

Wind

wind.direction returns the direction the wind is blowing in a zip code (string)

wind.speed returns the speed the wind is blowing in a zip code (number)

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.