Skip to content

springmeyer/vector-tile-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vector-tile-java

A Java library for efficient reading of Mapbox Vector Tiles.

This libraries is modeled after these high-performance Javascript libraries:

Usage

This library has no external dependencies.

Use it as follows:

    // Where `buf` is a `byte[]` representing an uncompressed Mapbox Vector Tile
    Pbf pbf = new Pbf(buf);
    VectorTile vectorTile = new VectorTile(pbf, pbf.length);
    for (VectorTileLayer layer : vectorTile.layers.values()) {
      System.out.println("Layer: " + layer.name);
      for (int i = 0; i < layer.length; i++) {
        VectorTileFeature feature = layer.feature(i);
        System.out.println("Feature: " + feature.id);
        System.out.println("Properties: " + feature.properties);
        System.out.println("Type: " + VectorTileFeature.types[feature.type]);
        System.out.println("Geometry: " + feature.loadGeometry());
      }
    }

Developing

Run the tests as follows:

gradle test

The tests currently only ensure that input MVT files can be parsed without errors.

No assertions on content are currently done.

If you'd like to check to see if your MVT file can be parsed, drop it in the ./fixtures directory and it will be automatically parsed in the tests.

About

Java library for efficient reading of Mapbox Vector Tiles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published