Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 952 Bytes

README.md

File metadata and controls

44 lines (31 loc) · 952 Bytes

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