db

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a timezone is not found
	ErrNotFound = errors.New("timezone not found")
	ErrInternal = errors.New("shape without tzID")
)

Functions

func IsOcean

func IsOcean(label string) bool

IsOcean checks if the timezone is for oceans

Types

type Geo2TzRTreeIndex

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

func NewGeo2TzRTreeIndexFromGeoJSON

func NewGeo2TzRTreeIndexFromGeoJSON(geoJSONPath string) (*Geo2TzRTreeIndex, error)

NewGeo2TzRTreeIndexFromGeoJSON creates a new Geo2TzRTreeIndex from a GeoJSON file

func (*Geo2TzRTreeIndex) Insert

func (g *Geo2TzRTreeIndex) Insert(min, max [2]float64, element timezoneGeo)

Insert adds a new timezone bounding box to the index

func (*Geo2TzRTreeIndex) Lookup

func (g *Geo2TzRTreeIndex) Lookup(lat, lng float64) (tzID string, err error)

Lookup returns the timezone ID for a given latitude and longitude if the timezone is not found, it returns an error It first searches in the land index, if not found, it searches in the sea index

type TzDBIndex

type TzDBIndex interface {
	Lookup(lat, lon float64) (string, error)
}

Jump to

Keyboard shortcuts

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