Go-Qibla is a Go package for calculating qibla direction for a specific location.
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
- Anugraha, R. 2012. Mekanika Benda Langit. (PDF)
Go-Qibla is distributed using MIT license.