coverage

package
v0.0.0-...-0f27594 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

package coverage provides methods for deriving map tile coverage for Who's On First records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoverageWithFeature

func CoverageWithFeature(ctx context.Context, opts *CoverageOptions, body []byte) (map[uint]maptile.Set, error)

CoverageWithFeature returns a map of tiles for a Who's On Feature record. The map is keyed by zoom level and the value of each is a list of tiles that cover the feature.

func CoverageWithFeatureAndCallback

func CoverageWithFeatureAndCallback(ctx context.Context, opts *CoverageOptions, body []byte, cb CoverageCallbackFunc) error

CoverageWithFeatureAndCallback will dispatch coverage information for each zoom level defined in 'opts' to a callback function defined in 'cb'.

func CoverageWithFeatureAndChannels

func CoverageWithFeatureAndChannels(ctx context.Context, opts *CoverageOptions, body []byte, rsp_ch chan *Coverage, err_ch chan error, done_ch chan bool)

CoverageWithFeatureAndChannels returns coverage information for each zoom level defined in 'opts' as it is determined using channels.

Types

type Coverage

type Coverage struct {
	// The Who's On First ID of the record being processed.
	Id int64
	// The zoom level being processed.
	Zoom uint
	// The set of tiles that cover feature 'Id' at zoom level 'Zoom'.
	Tiles maptile.Set
}

Coverage is a struct containing information returned by the CoverageWithFeatureAndChannels.

type CoverageCallbackFunc

type CoverageCallbackFunc func(context.Context, *Coverage) error

CoverageCallbackFunc is a user-defined callback function invoked by CoverageWithFeatureAndCallback method.

type CoverageOptions

type CoverageOptions struct {
	// A valid go-spatial/geom/slippy.Grid used to generate coverage information.
	Grid slippy.Grid
	// A list of zoom levels to determine coverage for.
	ZoomLevels []uint
}

CoverageOptions defines common options for the CoverageWithFeature and CoverageWithFeatureAndChannels methods

func DefaultCoverageOptions

func DefaultCoverageOptions() (*CoverageOptions, error)

DefaultCoverageOptions returns a CoverageOptions instance with a 4326 grid and zoom levels ranging from 1 to 20.

Jump to

Keyboard shortcuts

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