timezoneLookup

package module
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURL = "https://github.com/evansiroky/timezone-boundary-builder/releases/download/2020d/timezones-with-oceans.geojson.zip"
)

Variables

View Source
var (
	ErrCoordinatesNotValid = errors.New("Latitude and/or Longitude are not valid")
)

Functions

func ImportZipFile

func ImportZipFile(cache string, url string, iter func(tz Timezone) error) (err error)

ImportZipFile imports a url and saves it with the following filename. The iter function is run on the zip file.

func Verbose

func Verbose(v bool)

Verbose sets the import function to verbose

Types

type GeoJSONFeature

type GeoJSONFeature struct {
	Type       string `json:"type"`
	Properties struct {
		Tzid string `json:"tzid"`
	} `json:"properties"`
	Geometry struct {
		Item        string        `json:"type"`
		Coordinates []interface{} `json:"coordinates"`
	} `json:"geometry"`
}

GeoJSONFeature

type Result

type Result struct {
	Name        string
	Coordinates geo.LatLng
	Elapsed     time.Duration
}

Result is a timezone lookup result

type Timezone

type Timezone struct {
	Name     string
	Polygons []geo.Polygon `json:"polygons"`
}

Timezone

type Timezonecache

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

func (*Timezonecache) AddTimezone

func (tzc *Timezonecache) AddTimezone(tz Timezone)

func (*Timezonecache) BuildRtree

func (tzc *Timezonecache) BuildRtree()

func (*Timezonecache) Close

func (tzc *Timezonecache) Close() error

func (*Timezonecache) Load

func (tzc *Timezonecache) Load(f *os.File) (err error)

func (*Timezonecache) Save

func (tzc *Timezonecache) Save(filename string) error

func (*Timezonecache) Search

func (tzc *Timezonecache) Search(lat, lng float64) (Result, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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