Documentation ¶
Index ¶
- Constants
- Variables
- func Cleanup()
- func ConvertFeatureID(v interface{}) (uint64, error)
- func Drivers(types ...providerType) (l []string)
- func MVTRegister(name string, init MVTInitFunc, cleanup CleanupFunc) error
- func Register(name string, init InitFunc, cleanup CleanupFunc) error
- type CleanupFunc
- type ErrInvalidProviderType
- type ErrInvalidRegisteredProvider
- type ErrProviderAlreadyExists
- type ErrUnableToConvertFeatureID
- type ErrUnknownProvider
- type Feature
- type InitFunc
- type Layer
- type LayerInfo
- type Layerer
- type MVTInitFunc
- type MVTTiler
- type Map
- type MapLayer
- type Params
- type QueryParameter
- type QueryParameterValue
- type Tile
- type Tiler
- type TilerUnion
Constants ¶
const ( // TypeStd declares a provider to be a standard provider TypeStd providerType = 1 << iota // TypeMvt declares a provider to be an mvt provider. TypeMvt // TypeAll should be all the types TypeAll = TypeStd & TypeMvt )
Variables ¶
var ( // ErrCanceled is returned when cancel was requested ErrCanceled = fmt.Errorf("provider: %v", context.Canceled) ErrUnsupported = errors.New("provider: unsupported") ErrNilInitFunc = errors.New("init function can not be nil") )
var ParamTypeDecoders = map[string]func(string) (interface{}, error){ "int": func(s string) (interface{}, error) { return strconv.Atoi(s) }, "float": func(s string) (interface{}, error) { return strconv.ParseFloat(s, 32) }, "string": func(s string) (interface{}, error) { return s, nil }, "bool": func(s string) (interface{}, error) { return strconv.ParseBool(s) }, }
ParamTypeDecoders is a collection of parsers for different types of user-defined parameters
var ParameterTokenRegexp = regexp.MustCompile("![a-zA-Z0-9_-]+!")
ParameterTokenRegexp to validate QueryParameters
Functions ¶
func ConvertFeatureID ¶
ConvertFeatureID attempts to convert an interface value to an uint64
func Drivers ¶
func Drivers(types ...providerType) (l []string)
Drivers returns a list of registered drivers.
func MVTRegister ¶ added in v0.12.0
func MVTRegister(name string, init MVTInitFunc, cleanup CleanupFunc) error
MVTRegister 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.
The init function can not be nil, the cleanup function may be nil
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.
The init function can not be nil, the cleanup function may be nil
Types ¶
type CleanupFunc ¶
type CleanupFunc func()
CleanupFunc is called to when the system is shutting down, this allows the provider to cleanup.
type ErrInvalidProviderType ¶ added in v0.12.0
ErrInvalidProviderType is return when the requested provider type is not known for the given name
func (ErrInvalidProviderType) Error ¶ added in v0.12.0
func (err ErrInvalidProviderType) Error() string
type ErrInvalidRegisteredProvider ¶ added in v0.12.0
type ErrInvalidRegisteredProvider struct {
Name string
}
ErrInvalidRegisteredProvider is returned when something went wrong with the provider registration. This should never happen, in normal usage, and if it does it's an issue with the provider plugin.
func (ErrInvalidRegisteredProvider) Error ¶ added in v0.12.0
func (err ErrInvalidRegisteredProvider) Error() string
type ErrProviderAlreadyExists ¶ added in v0.11.0
type ErrProviderAlreadyExists struct {
Name string
}
ErrProviderAlreadyExists is returned when the Provider being registered already exists in the registration system
func (ErrProviderAlreadyExists) Error ¶ added in v0.11.0
func (err ErrProviderAlreadyExists) Error() string
type ErrUnableToConvertFeatureID ¶
type ErrUnableToConvertFeatureID struct {
// contains filtered or unexported fields
}
func (ErrUnableToConvertFeatureID) Error ¶
func (e ErrUnableToConvertFeatureID) Error() string
type ErrUnknownProvider ¶ added in v0.11.0
ErrUnknownProvider is returned when no providers are registered or requested provider is not registered
func (ErrUnknownProvider) Error ¶ added in v0.11.0
func (err ErrUnknownProvider) Error() string
type InitFunc ¶
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 Layer ¶ added in v0.12.0
type Layer struct { // Name is the name of the Layer as recognized by the provider Name string // MVTName is the name of the layer to encode into the MVT. // this is often used when different provider layers are used // at different zoom levels but the MVT layer name is consistent MVTName string }
Layer holds information about a query.
type LayerInfo ¶
type LayerInfo interface { // Name is the name of the layer Name() string // GeomType is the geometry type of the layer GeomType() geom.Geometry // SRID is the srid of all the points in the layer SRID() uint64 }
LayerInfo is the important information about a layer
type Layerer ¶ added in v0.11.0
type Layerer interface { // Layers returns information about the various layers the provider supports Layers() ([]LayerInfo, error) }
Layerer are objects that know about their layers
type MVTInitFunc ¶ added in v0.12.0
MVTInitFunc 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 Map ¶ added in v0.17.0
type Map struct { Name env.String `toml:"name"` Attribution env.String `toml:"attribution"` Bounds []env.Float `toml:"bounds"` Center [3]env.Float `toml:"center"` Layers []MapLayer `toml:"layers"` Parameters []QueryParameter `toml:"params"` TileBuffer *env.Int `toml:"tile_buffer"` }
A Map represents a map in the Tegola Config file.
type MapLayer ¶ added in v0.17.0
type MapLayer struct { // Name is optional. If it's not defined the name of the ProviderLayer will be used. // Name can also be used to group multiple ProviderLayers under the same namespace. Name env.String `toml:"name"` ProviderLayer env.String `toml:"provider_layer"` MinZoom *env.Uint `toml:"min_zoom"` MaxZoom *env.Uint `toml:"max_zoom"` DefaultTags env.Dict `toml:"default_tags"` // DontSimplify indicates whether feature simplification should be applied. // We use a negative in the name so the default is to simplify DontSimplify env.Bool `toml:"dont_simplify"` // DontClip indicates whether feature clipping should be applied. // We use a negative in the name so the default is to clipping DontClip env.Bool `toml:"dont_clip"` // DontClip 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 env.Bool `toml:"dont_clean"` }
MapLayer represents a the config for a layer in a map
func (MapLayer) GetName ¶ added in v0.17.0
GetName will return the user-defined Layer name from the config, or if the name is empty, return the name of the layer associated with the provider
func (MapLayer) ProviderLayerName ¶ added in v0.17.0
ProviderLayerName returns the names of the layer and provider or an error
type Params ¶ added in v0.17.0
type Params map[string]QueryParameterValue
func (Params) ReplaceParams ¶ added in v0.17.0
ReplaceParams substitutes configured query parameter tokens for their values within the provided SQL string
type QueryParameter ¶ added in v0.17.0
type QueryParameter struct { Name string `toml:"name"` Token string `toml:"token"` Type string `toml:"type"` SQL string `toml:"sql"` // DefaultSQL replaces SQL if param wasn't passed. Either default_sql or // default_value can be specified DefaultSQL string `toml:"default_sql"` DefaultValue string `toml:"default_value"` }
QueryParameter represents an HTTP query parameter specified for use with a given map instance.
func (*QueryParameter) Normalize ¶ added in v0.17.0
func (param *QueryParameter) Normalize()
Normalize normalizes param and sets default values
func (*QueryParameter) ToDefaultValue ¶ added in v0.17.0
func (param *QueryParameter) ToDefaultValue() (QueryParameterValue, error)
func (*QueryParameter) ToValue ¶ added in v0.17.0
func (param *QueryParameter) ToValue(rawValue string) (QueryParameterValue, error)
type QueryParameterValue ¶ added in v0.17.0
type QueryParameterValue struct { // Token to replace e.g., !TOKEN! Token string // SQL expression to be inserted. Contains "?" that will be replaced with an // ordinal argument e.g., "$1" SQL string // Value that will be passed to the final query in arguments list Value interface{} // Raw parameter and value for debugging and monitoring RawParam string // RawValue will be "" if the param wasn't passed and defaults were used RawValue string }
Query parameter holds normalized parameter data ready to be inserted in the final query
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.
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, params Params, fn func(f *Feature) error) error }
Tiler is a Layers that allows one to encode features in that layer
type TilerUnion ¶ added in v0.12.0
TilerUnion represents either a Std Tiler or and MVTTiler; only one should be not nil.
func For ¶
For function returns a configure provider of the given type; The provider may be a mvt provider or a std provider. The correct entry in TilerUnion will not be nil. If there is an error both entries will be nil.
func (TilerUnion) Layers ¶ added in v0.12.0
func (tu TilerUnion) Layers() ([]LayerInfo, error)
Layers return the layers of the Tiler. It will only return Std layers if STD is defined other the MVT layers
Source Files ¶
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 |