mvt

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version       = 2
	DefaultExtent = 4096
	MimeType      = "application/vnd.mapbox-vector-tile"
)

Variables

View Source
var (
	ErrNilFeature = fmt.Errorf("Feature is nil")
	// ErrUnknownGeometryType is the error retuned when the geometry is unknown.
	ErrUnknownGeometryType = fmt.Errorf("Unknown geometry type")
	ErrNilGeometryType     = fmt.Errorf("Nil geometry passed")
)

errors

Functions

func NewCursor added in v0.4.0

func NewCursor(tile *tegola.Tile) *cursor

func SimplifyGeometry added in v0.4.0

func SimplifyGeometry(g tegola.Geometry, tolerance float64, simplify bool) tegola.Geometry

Types

type Command

type Command uint32

func NewCommand

func NewCommand(cmd uint32, count int) Command

func (Command) Count

func (c Command) Count() int

func (Command) ID

func (c Command) ID() uint32

func (Command) String

func (c Command) String() string

type Feature

type Feature struct {
	ID   *uint64
	Tags map[string]interface{}
	// Does not support the collection geometry, for this you have to create a feature for each
	// geometry in the collection.
	Geometry tegola.Geometry
	// Unsimplifed weather the Geometry is simple already and thus does not need to be simplified.
	Unsimplifed *bool
}

Feature describes a feature of a Layer. A layer will contain multiple features each of which has a geometry describing the interesting thing, and the metadata associated with it.

func NewFeatures

func NewFeatures(geo tegola.Geometry, tags map[string]interface{}) (f []Feature)

NewFeatures returns one or more features for the given Geometry TODO: Should we consider supporting validation of polygons and multiple polygons here?

func (Feature) String

func (f Feature) String() string

func (*Feature) VTileFeature

func (f *Feature) VTileFeature(ctx context.Context, keys []string, vals []interface{}, tile *tegola.Tile, simplify bool, clip bool) (tf *vectorTile.Tile_Feature, err error)

VTileFeature will return a vectorTile.Feature that would represent the Feature

type Layer

type Layer struct {
	// This is the name of the feature, is has to be unique within a tile.
	Name string

	// DontSimplify truns off simplification for this layer.
	DontSimplify bool
	// MaxSimplificationZoom is the zoom level at which point simplification is turned off. if value is zero Max is set to 14. If you do not want to simplify at any level set DontSimplify to true.
	MaxSimplificationZoom uint
	// DontClip truns off clipping for this layer.
	DontClip bool
	// contains filtered or unexported fields
}

Layer describes a layer in the tile. Each layer can have multiple features which describe drawing.

func (*Layer) AddFeatures

func (l *Layer) AddFeatures(features ...Feature)

AddFeatures will add one or more Features to the Layer per the spec features SHOULD have unique ids but it's not required

func (*Layer) Extent

func (l *Layer) Extent() int

Extent defaults to 4096

func (*Layer) Features

func (l *Layer) Features() (f []Feature)

Features returns a copy of the features in the layer, use the index of the this array to remove any features from the layer

func (*Layer) RemoveFeature

func (l *Layer) RemoveFeature(idxs ...int)

RemoveFeature allows you to remove one or more features, with the provided indexes. To figure out the indexes, use the indexs from the Features array.

func (*Layer) SetExtent

func (l *Layer) SetExtent(e int)

SetExtent sets the extent value

func (*Layer) VTileLayer

func (l *Layer) VTileLayer(ctx context.Context, tile *tegola.Tile) (*vectorTile.Tile_Layer, error)

VTileLayer returns a vectorTile Tile_Layer object that represents this layer.

func (*Layer) Version

func (*Layer) Version() int

Version is the version of tile spec this layer is from.

type Tile

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

Tile describes a tile.

func (*Tile) AddLayers

func (t *Tile) AddLayers(layers ...*Layer) error

AddLayers adds a Layer to the tile

func (*Tile) Layers

func (t *Tile) Layers() (l []Layer)

Layers returns a copy of the layers in this tile.

func (*Tile) VTile

func (t *Tile) VTile(ctx context.Context, tile *tegola.Tile) (vt *vectorTile.Tile, err error)

VTile returns a tile object according to the Google Protobuff def. This function does the hard work of converting everything to the standard.

Directories

Path Synopsis
Package vectorTile is a generated protocol buffer package.
Package vectorTile is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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