martinlindhe / google-geolocate

Golang client for the Google Maps Geolocation API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

GoDoc

Golang client for the Google Maps Geocode and Geolocation API:s

https://developers.google.com/maps/documentation/geolocation/intro

Usage

import geo "github.com/martinlindhe/google-geolocate"

client := geo.NewGoogleGeo("api-key")

Geocode

res, _ := client.Geocode("New York City")
fmt.Println(res)
// Output: &{40.7127837 -74.0059413 New York, NY, USA}

Reverse geocode

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

res, _ := client.Geolocate()
fmt.Println(res)
// Output: &{ 40.7127837 -74.0059413}

License

Under MIT

Parts of the code was based on golang-geo

About

Golang client for the Google Maps Geolocation API

License:MIT License


Languages

Language:Go 100.0%