Packages
Implementation of the [Vector Tile Spec](https://github.com/mapbox/vector-tile-spec/tree/master/2.1), version 2.1. This package allows you to efficiently build vector tiles including layers and features with geometry and encode them to protobuf.
Current section
Files
Jump to
Current section
Files
vector_tile
README.md
README.md
# VectorTile
[](https://hex.pm/packages/vector_tile)
[](https://hexdocs.pm/vector_tile)
[](https://github.com/box-id/vector_tile/releases)
Implementation of the [Vector Tile Spec](https://github.com/mapbox/vector-tile-spec/tree/master/2.1), version 2.1. This
package allows you to efficiently build vector tiles including layers and features with geometry and encode them to
protobuf.
## Usage
The following sample shows how to create a simple vector tile with one layer and one point feature:
```elixir
alias VectorTile.{
Feature,
Layer,
Tile
}
# Create an empty named layer
layer = %Layer{
name: "clusters",
version: 2
}
# Add a feature with attributes
layer = Layer.add_feature(
layer,
Feature.point([128, 128]),
count: 42,
size: "large"
)
# Construct tile
tile = %Tile{
layers: [layer]
}
# Encode to protobuf bytes
Tile.encode(tile)
```
## Installation
```elixir
def deps do
[
{:vector_tile, "~> 1.1.0"}
]
end
```