places

package
v0.0.0-...-f11bb35 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZoomLevel = 15

	MapsURLTemplate = "https://www.google.com/maps/@%f,%f,%dz"
)
View Source
const (
	// GoogleMapsSecretKey is the enviroment key for the Google Maps API token.
	GoogleMapsSecretKey = "GOOGLE_MAPS_SECRET"

	StreetType  = "neighborhood"
	NumberType  = "street_number"
	StateType   = "administrative_area_level_1"
	CountryType = "country"
	CityType    = "political"

	// Regexp to see if the file path appears to be of a supported image type
	// (currently jpg/png).
	ImgRegexp = "^.*\\.(jpg|jpeg|png)"
)

Variables

View Source
var (
	ErrNoToken = fmt.Errorf(
		"No google maps API token (export %s=<API_TOKEN>).",
		GoogleMapsSecretKey,
	)
	ErrClientNotInitialized = fmt.Errorf("Google maps client has not been initialized")
)

Functions

func Goto

func Goto(path string) error

func Image

func Image(imagePath string) error

Image finds the place where a single photo was taken.

func Recursive

func Recursive(path string) error

Recursive prints all places in a directory, recursiveley.

func VisitPrintLocation

func VisitPrintLocation(path string, f os.FileInfo, err error) error

VisitPrintLocation implements a filepath.]WalkFunction that prints the location where an image was taken.

Types

type Location

type Location struct {
	City    string
	Country string
	Street  string
	Number  string
	State   string
}

Location desribes a location by various address elements.

func GetImageLocationData

func GetImageLocationData(path string) (*Location, error)

GetImageLocationData returns the Location at which an image, at a certain path was taken.

func (*Location) SetLocation

func (l *Location) SetLocation(addr []maps.AddressComponent)

SetLocation finds the relevant field types in a slice of address components and converts and sets the corresponding Locatio fields.

Jump to

Keyboard shortcuts

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