/go-qibla

Small package for calculating qibla direction

Primary LanguageGoMIT LicenseMIT

Go-Qibla

Go Report Card Go Reference

Go-Qibla is a Go package for calculating qibla direction for a specific location.

Usage Examples

Let's say we want to get qibla direction for Jakarta, Indonesia :

package main

import (
	"fmt"

	"github.com/hablullah/go-qibla"
)

func main() {
	// Try to calculate qibla direction from Jakarta
	jktLatitude := -6.169777778
	jktLongitude := 106.8307333
	qiblaDirection, qiblaDistance := qibla.Get(jktLatitude, jktLongitude)
	fmt.Printf("DIRECTION: %f degrees\n", qiblaDirection)
	fmt.Printf("DISTANCE: %f km\n", qiblaDistance)
}

Which will give us following results :

DIRECTION: 295.143458 degrees
DISTANCE: 7918.900254 km

Resources

  1. Anugraha, R. 2012. Mekanika Benda Langit. (PDF)

License

Go-Qibla is distributed using MIT license.