A java encoder and decoder for vector tiles according to Mapbox vector tile spec
Clone or download
Latest commit c8ee2f7 Nov 6, 2018
Permalink
Failed to load latest commit information.
src encode MultiPolygon properly. do not split to multiple features. Nov 6, 2018
.gitignore eclipse ignore stuff Nov 22, 2015
LICENSE Create LICENSE Jun 29, 2018
README.md 1.3.4 Nov 6, 2018
pom.xml 1.3.4 Nov 6, 2018

README.md

Java Vector Tiles

A java encoder and decoder for vector tiles according to Mapbox vector tile spec

Encode a vector tile

VectorTileEncoder encoder = new VectorTileEncoder();

// Add one or more features with a layer name, a Map with attributes and a JTS Geometry. 
// The Geometry uses (0,0) in upper left and (256,256) in lower right.
encoder.addFeature("road", attributes, geometry);

// Finally, get the byte array
byte[] encoded = encoder.encode();

or, specifying the feature id:

VectorTileEncoder encoder = new VectorTileEncoder();
encoder.addFeature("road", attributes, geometry, id);
byte[] encoded = encoder.encode();

Maven - with JTS from LocationTech

=======

<repository>
    <id>ECC</id>
    <url>https://github.com/ElectronicChartCentre/ecc-mvn-repo/raw/master/releases</url>
</repository>

<dependency>
    <groupId>no.ecc.vectortile</groupId>
    <artifactId>java-vector-tile</artifactId>
    <version>1.3.4</version>
</dependency>

Maven - with JTS from Vividsolutions

<repository>
    <id>ECC</id>
    <url>https://github.com/ElectronicChartCentre/ecc-mvn-repo/raw/master/releases</url>
</repository>

<dependency>
    <groupId>no.ecc.vectortile</groupId>
    <artifactId>java-vector-tile</artifactId>
    <version>1.2.4</version>
</dependency>

Generate VectorTile.java

protoc --java_out=src/main/java/ src/main/resources/vector_tile.proto

License

Apache License, version 2.0

Credits

Mapbox for their vector tile spec, Google for their Protocol Buffers and Dr JTS and LocationTech for JTS