Help us shape the future of Go! Take the 2026 Go Developer Survey

geocoding

package
v1.3.182 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageEnglish   = Language("en")
	LanguageBulgarian = Language("bg")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Found     bool
	FromCache bool
	Address   string
	Language  Language
	Location  *LatLng
}

type Geocoding

type Geocoding struct {
	// contains filtered or unexported fields
}

func (*Geocoding) CutCoordinates added in v1.3.28

func (g *Geocoding) CutCoordinates(float float64, precision int) (float64, error)

func (*Geocoding) Geocode

func (g *Geocoding) Geocode(ctx context.Context, ormService *beeorm.Engine, address string, language Language) (*Address, error)

func (*Geocoding) ReverseGeocode

func (g *Geocoding) ReverseGeocode(ctx context.Context, ormService *beeorm.Engine, latLng *LatLng, language Language) (*Address, error)

type GoogleMapsProvider

type GoogleMapsProvider struct {
	// contains filtered or unexported fields
}

func (*GoogleMapsProvider) Geocode

func (g *GoogleMapsProvider) Geocode(ctx context.Context, address string, language Language) (*Address, interface{}, error)

func (*GoogleMapsProvider) GetName

func (g *GoogleMapsProvider) GetName() string

func (*GoogleMapsProvider) ReverseGeocode

func (g *GoogleMapsProvider) ReverseGeocode(ctx context.Context, latLng *LatLng, language Language) (*Address, interface{}, error)

type IGeocoding

type IGeocoding interface {
	Geocode(ctx context.Context, ormService *beeorm.Engine, address string, language Language) (*Address, error)
	ReverseGeocode(ctx context.Context, ormService *beeorm.Engine, latLng *LatLng, language Language) (*Address, error)
	CutCoordinates(float float64, precision int) (float64, error)
}

func NewGeocoding

func NewGeocoding(
	useCaching bool,
	cacheTTLMinDays int,
	cacheTTLMaxDays int,
	clock clock.IClock,
	provider Provider,
) IGeocoding

type Language

type Language string

type LatLng

type LatLng struct {
	Lat float64
	Lng float64
}

type Provider

type Provider interface {
	Geocode(ctx context.Context, address string, language Language) (*Address, interface{}, error)
	ReverseGeocode(ctx context.Context, latLng *LatLng, language Language) (*Address, interface{}, error)
	GetName() string
}

func NewGoogleMapsProvider

func NewGoogleMapsProvider(apiKey string) Provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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