atlas

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 35 Imported by: 5

Documentation

Overview

Package atlas provides an abstraction for a collection of Maps.

Index

Constants

View Source
const (
	// MaxZoom will not render tile beyond this zoom level
	MaxZoom = tegola.MaxZ
)

Variables

View Source
var (
	ErrMissingCache = errors.New("atlas: missing cache")
	ErrMissingTile  = errors.New("atlas: missing tile")
)

Functions

func AddMap

func AddMap(m Map)

AddMap registers a map by name with defaultAtlas. if the map already exists it will be overwritten

func GetCache

func GetCache() cache.Interface

GetCache returns the registered cache for defaultAtlas, if one is registered, otherwise nil

func PurgeMapTile

func PurgeMapTile(m Map, tile *tegola.Tile) error

PurgeMapTile will purge a map tile from the configured cache backend for the defaultAtlas

func SeedMapTile

func SeedMapTile(ctx context.Context, m Map, z, x, y uint) error

SeedMapTile will generate a tile and persist it to the configured cache backend for the defaultAtlas

func SetCache

func SetCache(c cache.Interface)

SetCache sets the cache backend for defaultAtlas

func SetObservability added in v0.13.0

func SetObservability(o observability.Interface)

SetObservability sets the observability backend for the defaultAtlas

func StartSubProcesses added in v0.14.0

func StartSubProcesses()

Types

type Atlas

type Atlas struct {
	// for managing current access to the map container
	sync.RWMutex
	// contains filtered or unexported fields
}

Atlas holds a collection of maps. If the pointer to Atlas is nil, it will make use of the default atlas; as the container for maps. This is equivalent to using the functions in the package. An Atlas is safe to use concurrently.

func (*Atlas) AddMap

func (a *Atlas) AddMap(m Map)

AddMap registers a map by name. if the map already exists it will be overwritten

func (*Atlas) AllMaps

func (a *Atlas) AllMaps() []Map

AllMaps returns a slice of all maps contained in the Atlas so far.

func (*Atlas) GetCache

func (a *Atlas) GetCache() cache.Interface

GetCache returns the registered cache if one is registered, otherwise nil

func (*Atlas) Map

func (a *Atlas) Map(mapName string) (Map, error)

Map looks up a Map by name and returns a copy of the Map

func (*Atlas) Observer added in v0.13.0

func (a *Atlas) Observer() observability.Interface

func (*Atlas) PurgeMapTile

func (a *Atlas) PurgeMapTile(m Map, tile *tegola.Tile) error

PurgeMapTile will purge a map tile from the configured cache backend

func (*Atlas) SeedMapTile

func (a *Atlas) SeedMapTile(ctx context.Context, m Map, z, x, y uint) error

SeedMapTile will generate a tile and persist it to the configured cache backend

func (*Atlas) SetCache

func (a *Atlas) SetCache(c cache.Interface)

SetCache sets the cache backend

func (*Atlas) SetObservability added in v0.13.0

func (a *Atlas) SetObservability(o observability.Interface)

SetObservability will set the observability backend

func (*Atlas) StartSubProcesses added in v0.14.0

func (a *Atlas) StartSubProcesses()

type ErrMapNotFound

type ErrMapNotFound struct {
	Name string
}

func (ErrMapNotFound) Error

func (e ErrMapNotFound) Error() string

type Layer

type Layer struct {
	// optional. if not set, the ProviderLayerName will be used
	Name              string
	ProviderLayerName string
	MinZoom           uint
	MaxZoom           uint
	// instantiated provider
	Provider provider.Tiler
	// default tags to include when encoding the layer. provider tags take precedence
	DefaultTags env.Dict
	GeomType    geom.Geometry
	// DontSimplify indicates whether feature simplification should be applied.
	// We use a negative in the name so the default is to simplify
	DontSimplify bool
	// DontClip indicates whether feature clipping should be applied.
	// We use a negative in the name so the default is to clip
	DontClip bool
	// DontClean indicates whether feature cleaning (e.g. make valid) should be applied.
	// We use a negative in the name so the default is to clean
	DontClean bool
}

func (Layer) Collectors added in v0.14.0

func (l Layer) Collectors(prefix string, config func(configKey string) map[string]interface{}) ([]observability.Collector, error)

func (*Layer) MVTName

func (l *Layer) MVTName() string

MVTName will return the value that will be encoded in the Name field when the layer is encoded as MVT

type Map

type Map struct {
	Name string
	// Contains an attribution to be displayed when the map is shown to a user.
	// 	This string is sanitized so it can't be abused as a vector for XSS or beacon tracking.
	Attribution string
	// The maximum extent of available map tiles in WGS:84
	// latitude and longitude values, in the order left, bottom, right, top.
	// Default: [-180, -85, 180, 85]
	Bounds *geom.Extent
	// The first value is the longitude, the second is latitude (both in
	// WGS:84 values), the third value is the zoom level.
	Center [3]float64
	Layers []Layer
	// Params holds configured query parameters
	Params []provider.QueryParameter

	SRID uint64
	// MVT output values
	TileExtent uint64
	TileBuffer uint64
	// contains filtered or unexported fields
}

Map defines a Web Mercator map

func AllMaps

func AllMaps() []Map

AllMaps returns all registered maps in defaultAtlas

func GetMap

func GetMap(mapName string) (Map, error)

GetMap returns a copy of the a map by name from defaultAtlas. if the map does not exist it will return an error

func NewWebMercatorMap added in v0.6.0

func NewWebMercatorMap(name string) Map

NewWebMercatorMap creates a new map with the necessary default values

func (Map) AddDebugLayers added in v0.6.0

func (m Map) AddDebugLayers() Map

AddDebugLayers returns a copy of a Map with the debug layers appended to the layer list

func (Map) Collectors added in v0.14.0

func (m Map) Collectors(prefix string, config func(configKey string) map[string]interface{}) ([]observability.Collector, error)

func (Map) Encode

func (m Map) Encode(ctx context.Context, tile *slippy.Tile, params provider.Params) ([]byte, error)

Encode will encode the given tile into mvt format

func (Map) FilterLayersByName added in v0.6.0

func (m Map) FilterLayersByName(names ...string) Map

FilterLayersByName returns a copy of a Map with a subset of layers that match the supplied list of layer names

func (Map) FilterLayersByZoom added in v0.6.0

func (m Map) FilterLayersByZoom(zoom uint) Map

FilterLayersByZoom returns a copy of a Map with a subset of layers that match the given zoom

func (Map) HasMVTProvider added in v0.12.0

func (m Map) HasMVTProvider() bool

HasMVTProvider indicates if map is a mvt provider based map

func (Map) MVTProvider added in v0.12.0

func (m Map) MVTProvider() provider.MVTTiler

MVTProvider returns the mvt provider if this map is a mvt provider based map, otherwise nil

func (Map) MVTProviderName added in v0.12.0

func (m Map) MVTProviderName() string

MVTProviderName returns the mvt provider name if this map is a mvt provider based map, otherwise ""

func (*Map) SetMVTProvider added in v0.12.0

func (m *Map) SetMVTProvider(name string, p provider.MVTTiler) provider.MVTTiler

SetMVTProvider sets the map to be based on the passed in mvt provider, and returning the provider

Jump to

Keyboard shortcuts

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