Skip to content

didasy/n2yo-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n2yo-go

Build Status codecov GoDoc Go Report Card FOSSA Status

Unofficial n2yo Golang client.

Usage

Download and install it:

go get github.com/didasy/n2yo-go

Import it in your code:

import "github.com/didasy/n2yo-go

Simplest default example:

package main

import (
	"encoding/json"
	"fmt"
	"os"

	"github.com/didasy/n2yo-go"
)

func main() {
	apiKey := os.Getenv("N2YO_API_KEY")
	client := n2yo.New(apiKey)
	issNORADID := 25544
	lat := -6.200000
	long := 106.816666
	alt := 5.0
	sec := 1
	days := 1
	minVisibility := 1
	minElevation := 15

	// get ISS TLE
	res, err := client.GetTLE(issNORADID)
	if err != nil {
		panic(err)
	}
	data, err := json.MarshalIndent(res, "", "  ")
	if err != nil {
		panic(err)
	}

	fmt.Println("TLE:", string(data))

	// get ISS position
	res, err = client.GetPositions(issNORADID, lat, long, alt, sec)
	if err != nil {
		panic(err)
	}
	data, err = json.MarshalIndent(res, "", "  ")
	if err != nil {
		panic(err)
	}

	fmt.Println("Positions:", string(data))

	// get ISS visual passes
	res, err = client.GetVisualPasses(issNORADID, lat, long, alt, days, minVisibility)
	if err != nil {
		panic(err)
	}
	data, err = json.MarshalIndent(res, "", "  ")
	if err != nil {
		panic(err)
	}

	fmt.Println("Visual Passes:", string(data))

	// get ISS radio passes
	res, err = client.GetRadioPasses(issNORADID, lat, long, alt, days, minElevation)
	if err != nil {
		panic(err)
	}
	data, err = json.MarshalIndent(res, "", "  ")
	if err != nil {
		panic(err)
	}

	fmt.Println("Radio Passes:", string(data))
}

About

Unofficial n2yo.com client for Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages