Skip to content

Vertikar/weatherunderground

 
 

Repository files navigation

Placeholder for WeatherUndergroud Go API

GoDoc Build Status

Placeholder Go (golang) package for use with www.wunderground.com/s API.

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

Contributions welcome!

Features

Current Weather Conditions

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

Forecast

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

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

Data Available in Multiple Measurement Systems

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

Historical Conditions

  • ...still in the works...

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"

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

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

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

Current Conditions in metric by location name

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

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

Forecast Conditions in imperial by coordinates

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

    w.DailyByCoordinates(
    		&Coordinates{
    			Longitude: -112.07,
    			Latitude: 33.45,
    		},
    )
    fmt.Println(w)
}

Current conditions in metric by location ID

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

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

About

Go (golang) package for use with weatherunderground API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.9%
  • HTML 3.1%