com.pb.lisdk.vectortile.mvt

## Class MVTWriter

- java.lang.Object
- - com.pb.lisdk.vectortile.mvt.MVTWriter

All Implemented Interfaces:
  IVectorTileWriter

    public final class MVTWriter
    extends Object
    implements IVectorTileWriter

A writer that generates vector tiles for the Mapbox Vector Tile (MVT) format. See the MapBox vector tile specification for more details. The coordinates of the envelope passed into `startTile()` and the geometries passed into `addFeature()` are interpreted in screen coordinates relative to the top left corner of the tile currently processed. Non-integral coordinate values will be rounded to the nearest integer. Note that the MVT specification only supports square tiles, so the `startTile()` expects a square envelope.

### Constructor Summary

Constructors
Constructor and Description
`MVTWriter()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addFeature(Long key, IFeatureGeometry geometry, Map attributes)` Adds a new feature to the current layer.
`void` `endLayer()` Ends the process of writing to the layer.
`byte[]` `endTile()` Ends the process of creating a new tile.
`void` `startLayer(String name)` Starts the process of creating a new layer within the current tile.
`void` `startTile(Envelope mbr)` Starts the process of creating a tile, once startTile has been called, multiple layers and features can be added to the tile.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MVTWriter

    public MVTWriter()

### Method Detail

#### startTile

    public void startTile(Envelope mbr)

Starts the process of creating a tile, once startTile has been called, multiple layers and features can be added to the tile. The envelope is expected to be square.

Specified by:
  `startTile` in interface `IVectorTileWriter`
Parameters:
  `mbr` - the bounds of the tile to be created.
Throws:
  `IllegalArgumentException` - if the given envelope is not square
  `IllegalStateException` - if this writer is not in the `initial` state.

#### endTile

    public byte[] endTile()

Ends the process of creating a new tile.

Specified by:
  `endTile` in interface `IVectorTileWriter`
Returns:
  The vector tile
Throws:
  `IllegalStateException` - if the writer is not in the `writing tile` state.

#### startLayer

    public void startLayer(String name)

Starts the process of creating a new layer within the current tile.

Specified by:
  `startLayer` in interface `IVectorTileWriter`
Parameters:
  `name` - A unique layer name
Throws:
  `IllegalStateException` - if the writer is not in the `writing tile` state.

#### addFeature

    public void addFeature(Long key,
                           IFeatureGeometry geometry,
                           Map attributes)

Adds a new feature to the current layer.

Specified by:
  `addFeature` in interface `IVectorTileWriter`
Parameters:
  `key` - A unique feature key
  `geometry` - Geometry for the feature
  `attributes` - Attributes for the feature
Throws:
  `IllegalStateException` - if the writer is not in the `writing layer` state.

#### endLayer

    public void endLayer()

Ends the process of writing to the layer. Once called, no more features can be written to the current layer.

Specified by:
  `endLayer` in interface `IVectorTileWriter`
Throws:
  `IllegalStateException` - if the writer is not in the `writing layer` state.