Go client for Geocodio API v1.2
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
.gitignore
LICENSE
README.md
api.go
geocode.go
geocode_test.go
geocodio.go
geocodio_test.go
models.go
reverse.go
reverse_test.go

README.md

geocodio

GoDoc Go Report Card

Go client for Geocodio API v1

Usage

Geocode

import(
  "github.com/stevepartridge/geocodio"
  "fmt"
)

func main() {
  Geocodio, err := geocodio.NewGeocodio("YOUR_API_KEY")
	if err != nil {
		panic(err)
	}
	result, err := Geocodio.Geocode("42370 Bob Hope Dr, Rancho Mirage, CA")
	if err != nil {
		panic(err)
	}
	fmt.Printf("Geocode Result %v", result)
}

Reverse Geocode

import(
  "github.com/stevepartridge/geocodio"
  "fmt"
)

func main() {
  Geocodio, err := geocodio.NewGeocodio("YOUR_API_KEY")
	if err != nil {
		panic(err)
	}
	result, err := Geocodio.ReverseGeocode(38.9002898, -76.9990361)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Reverse Geocode Result %v", result)
}

Tests

You can run the tests leveraging your API key as an enviroment variable from terminal (*nix).

API_KEY=<YOUR_API_KEY> go test -v -cover