geocoding

package
v0.0.0-...-d72eed1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2014 License: GPL-2.0 Imports: 6 Imported by: 1

README

geocoding

Easy to use Google Maps geocoding and reverse-geocoding library.

API Documentation

Documentation

Overview

Package geocoding implements simple geocoding functions.

Index

Constants

View Source
const (
	// GoogleGeocodeURL is the base URL used for the geocoding API.
	GoogleGeocodeURL = "https://maps.googleapis.com/maps/api/geocode/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Results []Result `json:"results"`
	Status  string   `json:"status"`
}

Info is the type containing results and success status of geocoding.

func Geocode

func Geocode(address string) (info *Info, err error)

Geocode performs a forward geocoding request, converting an address into latlng.

func ReverseGeocode

func ReverseGeocode(latitude, longitude float64) (info *Info, err error)

ReverseGeocode performs a reverse geocoding request, converting latlng into an address.

type Result

type Result struct {
	AddressComponents []struct {
		LongName  string   `json:"long_name"`
		ShortName string   `json:"short_name"`
		Types     []string `json:"types"`
	} `json:"address_components"`
	FormattedAddress string `json:"formatted_address"`
	Geometry         struct {
		Location     maps.LatLngLocation `json:"location"`
		LocationType string              `json:"location_type"`
		ViewPort     struct {
			NorthEast maps.LatLngLocation `json:"northeast"`
			SouthWest maps.LatLngLocation `json:"southwest"`
		} `json:"viewport"`
	} `json:"geometry"`
	Types []string `json:"types"`
}

Result is the type specifying geocoding results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL