package
0.1.0
Repository: https://github.com/go-spatial/geom.git
Documentation: pkg.go.dev

# README

MVT

GoDoc

This package contains functions and types for encoding a geometry in Mapbox Vector Tiles. This package depends on the protbuf package.

In short, a Tiles has Layers, which have Feautures. The Feature type is what holds a single geom.Geometry and associated metadata.

To encode a geometry into a tile, you need:

  • a geometry
  • a tile's geom.Extent in the same projection as the geometry
  • the size of the tile you want to output in pixels

note: the geometry must not go outside the tile extent. If this is unknown, use the clip package before encoding.

To encode:

  1. Call PrepareGeomtry, it returns a geom.Geometry that is "reprojected" into pixel values relative to the tile
  2. Add the returned geometry to a Feature, optionally with an ID and tags by calling NewFeatures.
  3. Add the feature to a Layer with a name for the layer by calling (*Layer).AddFeatures
  4. Add the layer to a Tile by calling (*Tile).AddLayers
  5. Get the protobuf tile by calling (*Tile).VTile
  6. Encode the protobuf into bytes with proto.Marshal

For an example, check the use of this package in tegola/atlas/map.go

# Packages

Package vectorTile is a generated protocol buffer package.

# Functions

Decode reads all the data from r and decodes the MVT tile into a Tile TODO(ear7h): handle tile tags.
DecodeByte decodes the MVT encoded bytes into a Tile.
No description provided by the author
NewCommand return a new command encoder.
NewCursor creates a new cursor for drawing and MVT tile.
NewFeatures returns one or more features for the given Geometry.
PrepareGeo converts the geometry's coordinates to tile pixel coordinates.
TileGeomCollection returns all geometries in a tile as a collection.

# Constants

No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Feature describes a feature of a Layer.
Layer describes a layer within a tile.
Tile describes a Mapbox Vector Tile.

# Type aliases

No description provided by the author