https://github.com/allanpk716/google-geolocate
fork from github.com/martinlindhe/google-geolocate
https://github.com/allanpk716/google-geolocate
Last synced: 4 months ago
JSON representation
fork from github.com/martinlindhe/google-geolocate
- Host: GitHub
- URL: https://github.com/allanpk716/google-geolocate
- Owner: allanpk716
- License: mit
- Created: 2021-04-21T01:44:40.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-21T01:52:19.000Z (about 4 years ago)
- Last Synced: 2025-01-30T15:44:15.868Z (6 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
[](https://godoc.org/github.com/martinlindhe/google-geolocate)
[](https://travis-ci.org/martinlindhe/google-geolocate)Golang client for the Google Maps Geocode and Geolocation API:s
https://developers.google.com/maps/documentation/geolocation/intro
## Usage
```go
import geo "github.com/martinlindhe/google-geolocate"client := geo.NewGoogleGeo("api-key", "httpProxyUrl")
```## Geocode
```go
res, _ := client.Geocode("New York City")
fmt.Println(res)
// Output: &{40.7127837 -74.0059413 New York, NY, USA}
```## Reverse geocode
```go
p := geo.Point{Lat: 40.7127837, Lng: -74.0059413}
res, _ := client.ReverseGeocode(&p)
fmt.Println(res)
// Output: New York City Hall, New York, NY 10007, USA
```## Geolocate
```go
res, _ := client.Geolocate()
fmt.Println(res)
// Output: &{ 40.7127837 -74.0059413}
```### License
Under [MIT](LICENSE)
Parts of the code was based on [golang-geo](https://github.com/kellydunn/golang-geo)