internal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2024 Michael Davis

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	MaxZoom = 21
)

Variables

This section is empty.

Functions

func GetVersionInformation added in v0.1.0

func GetVersionInformation() (string, string, string)

Returns a tuple containing build version information. Returns: Version in the format vX.Y.Z - will include placeholders for unofficial builds Verson Control System identifier (git ref) Timestamp of when it was built

func ParseZoomString added in v0.2.0

func ParseZoomString(str string) ([]int, error)

func RandomString added in v0.4.0

func RandomString() string

func ReplaceEnv added in v0.3.0

func ReplaceEnv(rawConfig map[string]interface{}) map[string]interface{}

Find any string values that start with `env.` and interpret the rest as an environment variable. Replaces the full value with the contents of the respective environment variable. Useful for avoiding secrets in config so your configuration can be placed in source control

func Ternary added in v0.4.0

func Ternary[T any](cond bool, a T, b T) T

Types

type Bounds

type Bounds struct {
	South float64
	North float64
	West  float64
	East  float64
}

func NewBoundsFromGeohash added in v0.4.0

func NewBoundsFromGeohash(hashStr string) (Bounds, error)

func (Bounds) Contains added in v0.4.0

func (b Bounds) Contains(b2 Bounds) bool

The bounds passed in is fully contained by this bounds

func (Bounds) FindTiles

func (b Bounds) FindTiles(layerName string, zoom uint, force bool) (*[]TileRequest, error)

func (Bounds) Intersects added in v0.2.0

func (b Bounds) Intersects(b2 Bounds) bool

Any part of this bounds and the bounds passed in touch

func (Bounds) IsNullIsland added in v0.4.0

func (b Bounds) IsNullIsland() bool

This bounds just has the default values (all coords are 0)

type Image

type Image = []byte

type RangeError

type RangeError struct {
	ParamName string
	MinValue  float64
	MaxValue  float64
}

func (RangeError) Error

func (e RangeError) Error() string

type RequestContext added in v0.2.0

type RequestContext struct {
	context.Context

	LimitLayers         bool
	AllowedLayers       []string
	AllowedArea         Bounds
	UserIdentifier      string
	LayerPatternMatches map[string]string
	SkipCacheSave       bool
	// contains filtered or unexported fields
}

Custom context type. Links back to request so we can pull attrs into the structured log

func BackgroundContext added in v0.2.0

func BackgroundContext() *RequestContext

func NewRequestContext added in v0.2.0

func NewRequestContext(req *http.Request) RequestContext

func (*RequestContext) Value added in v0.2.0

func (c *RequestContext) Value(keyAny any) any

type TileRequest

type TileRequest struct {
	LayerName string
	Z         int
	X         int
	Y         int
}

func (TileRequest) GetBounds

func (t TileRequest) GetBounds() (*Bounds, error)

func (TileRequest) IntersectsBounds added in v0.2.0

func (t TileRequest) IntersectsBounds(b Bounds) (bool, error)

func (TileRequest) String

func (t TileRequest) String() string

type TooManyTilesError added in v0.4.0

type TooManyTilesError struct {
	NumTiles uint64
}

func (TooManyTilesError) Error added in v0.4.0

func (e TooManyTilesError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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