Class MvtDecoder

java.lang.Object
com.codename1.maps.vector.MvtDecoder

public final class MvtDecoder extends Object

Decodes a Mapbox Vector Tile (MVT 2.1, application/x-protobuf) into the in-memory VectorTile model using the framework's protobuf reader (ProtoReader).

The geometry command stream is decoded per the MVT spec: integers are either (command | count << 3) headers or zig-zag delta-encoded parameters; MoveTo (1) starts a part, LineTo (2) extends it and ClosePath (7) ends a polygon ring. Coordinates are kept tile-local (0..extent); projection to the screen happens in TileRenderer.

  • Method Details

    • decode

      public static VectorTile decode(byte[] data) throws IOException
      Decodes raw tile bytes into a VectorTile. The input must already be decompressed (the tile sources gunzip transparently).
      Throws:
      IOException