geocoding

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 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 *datalayer.ORM, address string, language Language) (*Address, error)

func (*Geocoding) ReverseGeocode

func (g *Geocoding) ReverseGeocode(ctx context.Context, ormService *datalayer.ORM, 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 *datalayer.ORM, address string, language Language) (*Address, error)
	ReverseGeocode(ctx context.Context, ormService *datalayer.ORM, 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