go get -u github.com/cclin81922/ipttmrts/cmd/ipttmrts
export PATH=$PATH:~/go/bin
Usage 1
GoogleGeolocationAPIKey=... ipttmrts
// output the nearest MRT station
Usage 2
ipttmrts -ip=101.15.22.238
// output the nearest MRT station
To output debug message as well, use flag -logtostderr=true -v=2
import "github.com/cclin81922/ipttmrts/pkg/ipttmrts"
func demo(data ipttmrts.IData) {
ipttmrts.Map(data)
}
Run all tests
go test github.com/cclin81922/ipttmrts/pkg/ipttmrts
Run selected tests e.g.,
go test github.com/cclin81922/ipttmrts/pkg/ipttmrts -run=TestFindNearTaipeiMRTStation/誠正國中
Run all benchmarks
go test github.com/cclin81922/ipttmrts/pkg/ipttmrts -bench=. -benchmem
Run selected benchmarks e.g.,
go test github.com/cclin81922/ipttmrts/pkg/ipttmrts -bench=BenchmarkFindNearTaipeiMRTStation/誠正國中 -benchmem
View API doc by terminal
go doc github.com/cclin81922/ipttmrts/pkg/ipttmrts
View API doc by web browser (offline)
godoc -http=:6060
open http://localhost:6060/pkg/github.com/cclin81922/ipttmrts/pkg/ipttmrts
View API doc by web browser (online)
open https://godoc.org/github.com/cclin81922/ipttmrts/pkg/ipttmrts
- The greate circle distance
- Online tool to calculate distance between two location by geographic coordinate
- Open data of Taipei MRT stations locations with geographic coordinate
- Golang code gist which calculates distance between two location by geographic coordinate
- Golang code gist which demonstrates glog usage
- Google Geolocation API to get location geographic coordinate
- KeyCDN API to get locaiton geographic coordinate