provider

package
v0.0.0-...-05a1c04 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanceled    = errors.New("provider: canceled")
	ErrUnsupported = errors.New("provider: unsupported")
)

Functions

func Cleanup

func Cleanup()

func ConvertFeatureID

func ConvertFeatureID(v interface{}) (uint64, error)

ConvertFeatureID attempts to convert an interface value to an uint64

func Drivers

func Drivers() (l []string)

Drivers returns a list of registered drivers.

func Exists

func Exists(name string) bool

Exists returns if the provider has been registered already

func Register

func Register(name string, init InitFunc, cleanup CleanupFunc) error

Register the provider with the system. This call is generally made in the init functions of the provider.

the clean up function will be called during shutdown of the provider to allow the provider to do any cleanup.

Types

type CleanupFunc

type CleanupFunc func()

CleanupFunc is called to when the system is shuting down, this allows the provider to cleanup.

type ErrProviderAlreadyExists

type ErrProviderAlreadyExists struct {
	Name string
}

ErrProviderAlreadyExists is returned when the Provided being registered already exists in the registration system

func (ErrProviderAlreadyExists) Error

func (err ErrProviderAlreadyExists) Error() string

type ErrUnableToConvertFeatureID

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

func (ErrUnableToConvertFeatureID) Error

type ErrUnknownProvider

type ErrUnknownProvider struct {
	Name               string
	KnownProvidersFunc func() []string
}

ErrUnknownProvider is returned when no providers are registered or a requested provider is not registered

func (ErrUnknownProvider) Error

func (err ErrUnknownProvider) Error() string

type Feature

type Feature struct {
	ID       uint64
	Geometry geom.Geometry
	SRID     uint64
	Tags     map[string]interface{}
}

type InitFunc

type InitFunc func(dicter dict.Dicter) (Tiler, error)

InitFunc initialize a provider given a config map. The init function should validate the config map, and report any errors. This is called by the For function.

type LayerInfo

type LayerInfo interface {
	Name() string
	GeomType() geom.Geometry
	SRID() uint64
}

type Layerer

type Layerer interface {
	// Layers returns information about the various layers the provider supports
	Layers() ([]LayerInfo, error)
}

type Tile

type Tile interface {
	// ZXY returns the z, x and y values of the tile
	ZXY() (uint, uint, uint)
	// Extent returns the extent of the tile excluding any buffer
	Extent() (extent *geom.Extent, srid uint64)
	// BufferedExtent returns the extent of the tile including any buffer
	BufferedExtent() (extent *geom.Extent, srid uint64)
}

Tile is an interface used by Tiler, it is an unnecessary abstraction and is due to be removed. The tiler interface will, instead take a, *geom.Extent.

func NewTile

func NewTile(z, x, y, buf, srid uint) Tile

type Tiler

type Tiler interface {
	Layerer

	// TileFeature will stream decoded features to the callback function fn
	// if fn returns ErrCanceled, the TileFeatures method should stop processing
	TileFeatures(ctx context.Context, layer string, t Tile, fn func(f *Feature) error) error
}

func For

func For(name string, config dict.Dicter) (Tiler, error)

For function returns a configured provider of the given type, provided the correct config map.

Directories

Path Synopsis
The debug provider returns features that are helpful for debugging a tile including a box for the tile edges and a point in the middle of the tile with z,x,y values encoded
The debug provider returns features that are helpful for debugging a tile including a box for the tile edges and a point in the middle of the tile with z,x,y values encoded

Jump to

Keyboard shortcuts

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