Skip to content

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

License

Notifications You must be signed in to change notification settings

ElectronicChartCentre/java-vector-tile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

<repository>
    <id>ECC</id>
    <url>https://maven.ecc.no/releases</url>
</repository>

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

Generate VectorTile.java

VectorTile.java is generated from src/main/porobuf/vector_tile.proto using the protoc-jar-maven-plugin plugin. Make sure to include the folder target/generated-sources in your class path.

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages