All Projects → briandowns → Openweathermap

briandowns / Openweathermap

Licence: apache-2.0
Go (golang) package for use with openweathermap.org's API.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Openweathermap

Ansiweather
Weather in terminal, with ANSI colors and Unicode symbols
Stars: ✭ 1,663 (+932.92%)
Mutual labels:  weather
Weather
🌈 基于高德开放平台接口的 PHP 天气信息组件。
Stars: ✭ 143 (-11.18%)
Mutual labels:  weather
Flutter app
🔥🔥🔥本项目包括各种基本控件使用(Text、TextField、Icon、Image、Listview、Gridview、Picker、Stepper、Dialog、Slider、Row、Appbar、Sizebox、BottomSheet、Chip、Dismissible、FlutterLogo、Check、Switch、TabBar、BottomNavigationBar、Sliver等)、豆瓣电影、tubitv、每日一文、和天气、百姓生活、随机诗词、联系人、句子迷、好奇心日报、有道精品课、高德定位、音乐播放器🎵、追书神器等板块
Stars: ✭ 2,140 (+1229.19%)
Mutual labels:  weather
Weewx Belchertown
A clean and modern weewx skin with real time streaming updates, forecast data and interactive charts. View it in action at BelchertownWeather.com
Stars: ✭ 131 (-18.63%)
Mutual labels:  weather
Weather
A weather app built to learn how to use Canvas and Animation in Flutter.
Stars: ✭ 138 (-14.29%)
Mutual labels:  weather
Wradlib
weather radar data processing - python package
Stars: ✭ 143 (-11.18%)
Mutual labels:  weather
Meteorological Books
气象相关书籍合集(持续更新)
Stars: ✭ 125 (-22.36%)
Mutual labels:  weather
E paper weather display
Raspberry Pi weather display using Waveshare e-paper display and Open Weather Map API
Stars: ✭ 159 (-1.24%)
Mutual labels:  weather
Forecastr
A simple, asynchronous Objective-C wrapper for the Forecast.io API
Stars: ✭ 143 (-11.18%)
Mutual labels:  weather
Repaper
Desktop that changes based on weather & time
Stars: ✭ 148 (-8.07%)
Mutual labels:  weather
Hkosharp
Unofficial C# Library of Hong Kong Observatory API
Stars: ✭ 135 (-16.15%)
Mutual labels:  weather
Simple Weather Card
Minimalistic weather card for Home Assistant
Stars: ✭ 135 (-16.15%)
Mutual labels:  weather
Nearbyweather
NearbyWeather is an open source weather app for iOS, which uses the OpenWeatherMap API. With this project developers are invited to learn advanced iOS concepts, as well as to contribute further advancements. Fork this repo to get started.
Stars: ✭ 146 (-9.32%)
Mutual labels:  weather
Emacs Wttrin
Emacs frontend for weather web service wttr.in.
Stars: ✭ 129 (-19.88%)
Mutual labels:  weather
Launchbar
LaunchBar Actions
Stars: ✭ 155 (-3.73%)
Mutual labels:  weather
Python Workshop
A series of Jupyter Notebooks on exploring Unidata technology with Python. See website for more information.
Stars: ✭ 127 (-21.12%)
Mutual labels:  weather
Trail Sense
An Android app that uses your phone's sensors to assist with wilderness treks or survival situations.
Stars: ✭ 144 (-10.56%)
Mutual labels:  weather
Pysteps
Python framework for short-term ensemble prediction systems.
Stars: ✭ 159 (-1.24%)
Mutual labels:  weather
Openweathermap Reactnative
Weather, everybody wants to know how it is going to be during the week. Will it be rainy, windy, or sunny? Luckily for us, in the information age, there are open APIs to retrieve information about it.
Stars: ✭ 157 (-2.48%)
Mutual labels:  weather
Ocula
The free and open-source progressive weather app
Stars: ✭ 147 (-8.7%)
Mutual labels:  weather

OpenWeatherMap Go API

GoDoc Build Status Coverage Status

Go (golang) package for use with openweathermap.org's API.

For more detail about the library and its features, reference your local godoc once installed.

Website!

To use the OpenweatherMap API, you need to obtain an API key. Sign up here. Once you have your key, create an environment variable called OWM_API_KEY. Start coding!

Slack Channel

Contributions welcome!

Features

Current Weather Conditions

  • By City
  • By City,St (State)
  • By City,Co (Country)
  • By City ID
  • By Zip,Co (Country)
  • By Longitude and Latitude

Forecast

Get the weather conditions for a given number of days.

  • By City
  • By City,St (State)
  • By City,Co (Country)
  • By City ID
  • By Longitude and Latitude

Access to Condition Codes and Icons

Gain access to OpenWeatherMap icons and condition codes.

  • Thunderstorms
  • Drizzle
  • Rain
  • Snow
  • Atmosphere
  • Clouds
  • Extreme
  • Additional

Data Available in Multiple Measurement Systems

  • Fahrenheit (OpenWeatherMap API - imperial)
  • Celsius (OpenWeatherMap API - metric)
  • Kelvin (OpenWeatherMap API - internal)

UV Index Data

  • Current
  • Historical

Pollution Data

  • Current

Historical Conditions

  • By Name
  • By ID
  • By Coordinates

Supported Languages

English - en, Russian - ru, Italian - it, Spanish - es (or sp), Ukrainian - uk (or ua), German - de, Portuguese - pt, Romanian - ro, Polish - pl, Finnish - fi, Dutch - nl, French - fr, Bulgarian - bg, Swedish - sv (or se), Chinese Traditional - zh_tw, Chinese Simplified - zh (or zh_cn), Turkish - tr, Croatian - hr, Catalan - ca

Installation

go get github.com/briandowns/openweathermap

Examples

There are a few full examples in the examples directory that can be referenced. 1 is a command line application and 1 is a simple web application.

package main

import (
	"log"
	"fmt"
	"os"

	// Shortening the import reference name seems to make it a bit easier
	owm "github.com/briandowns/openweathermap"
)

var apiKey = os.Getenv("OWM_API_KEY")

func main() {
	w, err := owm.NewCurrent("F", "ru", apiKey) // fahrenheit (imperial) with Russian output
	if err != nil {
		log.Fatalln(err)
	}

	w.CurrentByName("Phoenix")
	fmt.Println(w)
}

Current Conditions by location name

func main() {
    w, err := owm.NewCurrent("K", "EN", apiKey) // (internal - OpenWeatherMap reference for kelvin) with English output
    if err != nil {
        log.Fatalln(err)
    }

    w.CurrentByName("Phoenix,AZ")
    fmt.Println(w)
}

Forecast Conditions in imperial (fahrenheit) by coordinates

func main() {
    w, err := owm.NewForecast("5", "F", "FI", apiKey) // valid options for first parameter are "5" and "16"
    if err != nil {
        log.Fatalln(err)
    }

    w.DailyByCoordinates(
        &owm.Coordinates{
                Longitude: -112.07,
                Latitude: 33.45,
        },
        5 // five days forecast
    )
    fmt.Println(w)
}

Current conditions in metric (celsius) by location ID

func main() {
    w, err := owm.NewCurrent("C", "PL", apiKey)
    if err != nil {
        log.Fatalln(err)
    }

    w.CurrentByID(2172797)
    fmt.Println(w)
}

Current conditions by zip code. 2 character country code required

func main() {
    w, err := owm.NewCurrent("F", "EN", apiKey)
    if err != nil {
        log.Fatalln(err)
    }

    w.CurrentByZip(19125, "US")
    fmt.Println(w)
}

Configure http client

func main() {
    client := &http.Client{}
    w, err := owm.NewCurrent("F", "EN", apiKey, owm.WithHttpClient(client))
    if err != nil {
        log.Fatalln(err)
    }
}

Current UV conditions

func main() {
    uv, err := owm.NewUV(apiKey)
    if err != nil {
        log.Fatalln(err)
    }

    coord := &owm.Coordinates{
        Longitude: 53.343497,
        Latitude:  -6.288379,
    }

    if err := uv.Current(coord); err != nil {
        log.Fatalln(err)
    }
    
    fmt.Println(coord)
}

Historical UV conditions

func main() {
    uv, err := owm.NewUV(apiKey)
    if err != nil {
        log.Fatalln(err)
    }

    coord := &owm.Coordinates{
        Longitude: 54.995656,
        Latitude:  -7.326834,
    }

    end := time.Now().UTC()
    start := time.Now().UTC().Add(-time.Hour * time.Duration(24))

    if err := uv.Historical(coord, start, end); err != nil {
        log.Fatalln(err)
    }
}

UV Information

func main() {
    uv, err := owm.NewUV(apiKey)
    if err != nil {
        log.Fatalln(err)
    }
    
    coord := &owm.Coordinates{
    	Longitude: 53.343497,
    	Latitude:  -6.288379,
    }
    
    if err := uv.Current(coord); err != nil {
    	log.Fatalln(err)
    }

    info, err := uv.UVInformation()
    if err != nil {
        log.Fatalln(err)
    }
    
    fmt.Println(info)
}

Pollution Information

func main() {
    pollution, err := owm.NewPollution(apiKey)
    if err != nil {
        log.Fatalln(err)
    }

    params := &owm.PollutionParameters{
        Location: owm.Coordinates{
            Latitude:  0.0,
            Longitude: 10.0,
        },
        Datetime: "current",
    }

    if err := pollution.PollutionByParams(params); err != nil {
        log.Fatalln(err)
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].