Example #1
0
func TestReverseGeocodeFromNewGoogleGeocoder(t *testing.T) {
	geocoder := google.NewGeocoder()

	res, _ := geocoder.ReverseGeocode(47.6064, -122.330803)

	var address google.Address
	google.ReadResponse(res, &address)

	assert.Equal(t, "Seattle", address.City)
	assert.Equal(t, "WA", address.State)
	assert.Equal(t, "US", address.Country)
}
Example #2
0
func TestReverseGeocodeForMSU(t *testing.T) {
	lat, lng := 42.72476, -84.473639

	geocoder := google.NewGeocoder()

	res, _ := geocoder.ReverseGeocode(lat, lng)

	var address google.Address
	google.ReadResponse(res, &address)

	assert.Equal(t, "East Lansing", address.City)
	assert.Equal(t, "MI", address.State)
	assert.Equal(t, "US", address.Country)
}