# Packages
No description provided by the author
# README
MVT
This package contains functions and types for encoding a geometry in Mapbox Vector Tiles. This package depends on the protbuf package.
In short, a Tile
s has Layer
s, which have Feauture
s. 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:
- Call
PrepareGeomtry
, it returns ageom.Geometry
that is "reprojected" into pixel values relative to the tile - Add the returned geometry to a
Feature
, optionally with an ID and tags by callingNewFeatures
. - Add the feature to a
Layer
with a name for the layer by calling(*Layer).AddFeatures
- Add the layer to a
Tile
by calling(*Tile).AddLayers
- Get the
protobuf
tile by calling(*Tile).VTile
- Encode the
protobuf
into bytes withproto.Marshal
For an example, check the use of this package in tegola/atlas/map.go