go install github.com/ringsaturn/pk
k, _ := pk.GeoToPlacekey(39.9289, 116.3883)
fmt.Println(k)
// Output: @6qk-v3d-brk
lat, long, _ := pk.PlacekeyToGeo("@6qk-v3d-brk")
fmt.Printf("%.3f %.3f \n", lat, long)
// Output: 39.929 116.388
More usage examples: https://pkg.go.dev/github.com/ringsaturn/pk#pkg-examples
go install github.com/ringsaturn/pk/cmd/placekey@latest
ToGeo
:
placekey ToGeo -pk "@627-wbz-tjv"
Output:
40.71237820442784 -74.0056425771711
FromGeo
placekey FromGeo -lat 40.71237820442784 -lng -74.0056425771711
Output:
@627-wbz-tjv