mvt

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

View Source
var ErrCanceled = context.Canceled

Functions

func NewCursor added in v0.4.0

func NewCursor(tile tegola.BoundingBox, layerExtent int) *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{}, extent tegola.BoundingBox, layerExtent int, simplify 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
	// 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) (skipped bool)

AddFeatures will add one or more Features to the Layer, if a features ID is a the same as Any already in the Layer, it will ignore those features. If the id fields is nil, the feature will always be added.

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, extent tegola.BoundingBox) (*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 LayerInfo added in v0.4.0

type LayerInfo interface {
	Name() string
	GeomType() tegola.Geometry
	SRID() int
}

type Provider

type Provider interface {
	// MVTLayer returns a mvt.Layer struct
	MVTLayer(ctx context.Context, providerLayerName string, tile tegola.Tile, tags map[string]interface{}) (*Layer, error)
	// Layers returns information about the various layers the provider supports
	Layers() ([]LayerInfo, error)
}

Provider is the mechanism by which the system talks to different data providers.

type Tile

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

Tile describes a tile.

func TileFromVTile

func TileFromVTile(t *vectorTile.Tile) (*Tile, error)

TODO: What is this functions suppose to do? TileFromVTile will return a Tile object from the given vectorTile Tile object

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, extent tegola.BoundingBox) (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