Giter VIP home page Giter VIP logo

gcd's Introduction

gcd

Go Report Card PkgGoDev

A golang-implemented GCD (great-circular distance) calculator with geolocation finding feature using Google Geolocation API.

Go で実装した大円距離計算機です。Google Geolocation API で地点を検索する機能もあります。

Library

go get github.com/mikan/gcd

GCD calculation example:

package main

import "github.com/mikan/gcd"

func main() {
	from := gcd.Coordinate{Latitude: 35.7719867, Longitude: 140.3928501}
	to := gcd.Coordinate{Latitude: 35.76483331, Longitude: 140.3860192}
	gcd.HaversineDistance(from, to) // 60.66175074135226 (km)
}

Location finding example:

package main

import "github.com/mikan/gcd"

func main() {
	from, err := gcd.FindPlaceWithGoogle("API_KEY", "Haneda Airport")
	if err != nil {
		panic(err)
	}
	to, err := gcd.FindPlaceWithGoogle("API_KEY", "Narita Airport")
	if err != nil {
		panic(err)
	}
	if len(from) > 0 && len(to) > 0 {
		gcd.HaversineDistance(from[0], to[0]) // 60.66175074135226 (km)
	}
}

CLI

go install github.com/mikan/gcd@latest

Usage:

gcd -key <API_KEY> <FROM_KEYWORD> <TO_KEYWORD>

Example:

% gcd -key xxx "Haneda Airport" "Narita Airport"
Haneda Airport:
* 35.5493932,139.7798386 羽田空港
Narita Airport:
* 35.7719867,140.3928501 成田国際空港
60.66175074135226km

Author

License

BSD 3-clause License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.