Giter VIP home page Giter VIP logo
 photo

weatherprovider Goto Github PK

repos: 4.0 gists: 0.0

Type: Organization

Bio: No longer under active development. A free and open-source weather API, powered by government data.

ARCHIVED
If you are interested in weather data, try:
United States: NationalWeatherService-Swift
Canada: MeteorologicalServiceOfCanada-Swift

Weather Provider Logo

WeatherProvider

Swift 5.3 MIT License

A free and open-source weather API, powered by government data.

Platforms

Platform CI
Apple Apple
Linux (Ubuntu & Amazon) Linux

About

Flexible

Data sources can be easily incorporated by conforming to WeatherProvider. Failing data sources are handled gracefully.

Decentralized

It is possible to use this library in your app to directly query the weather source. This is useful if you do not want to pay for a server . However, you can also use this library on a server if you prefer more control. See WeatherProvider-Server.

Privacy

Instead of providing an accurate coordinate, you may provide a location in the form of a Geohash, which has varying degrees of accuracy depending on your configuration.

Installation

Use Swift Package Manager.

IMPORTANT

YOU NEED TO DO SOME CONFIGURATION BEFORE YOU CAN USE WEATHER PROVIDER. SEE CONFIGURATION.

How to Use

As of 0.3.0, this package only supports the National Weather Service and getting the current weather condition.

let weatherProvider = WeatherProvider()

weatherProvider.getCurrentConditions(for: Coordinates(latitude: 47.6174, latitude: -122.2017)) { result in
   switch result {
      case .success(let conditions):   print(conditions)
      case .failure(let error):        print(error)
   }
}

If you prefer, you can use a geohash instead of exact coordinates. Note that using a geohash will use the center coordinate of that geohash, so you'll want to be careful of how precise of a hash you want to use.

let geohash = Geohash(coordinates: (47.6174, -122.2017), precision: 5)  // "c23ng"

weatherProvider.getCurrentConditions(for: geohash) { result in          // results in (47.61474609375, -122.18994140625)
   switch result {
      case .success(let conditions):   print(conditions)
      case .failure(let error):        print(error)
   }
}

Important

This project is currently unstable, subject to major API changes. As of now, a lot of the terminology is based off the United States National Weather Services definitions. I am looking to generalize the model as I continue to incorporate more sources.

License

  • This Swift library is MIT License.
  • Data source licenses may vary, but in general should be public-domain.

weatherprovider's Projects

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.