Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ElectronicChartCentre/java-vector-tile

A java encoder and decoder for vector tiles according to Mapbox vector tile spec
https://github.com/ElectronicChartCentre/java-vector-tile

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Java Vector Tiles

A java encoder and decoder for vector tiles according to
[Mapbox vector tile spec](https://github.com/mapbox/vector-tile-spec)

## Encode a vector tile

```java
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:

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

## Maven

```

ECC
https://maven.ecc.no/releases

no.ecc.vectortile
java-vector-tile
1.3.23

```

## 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](http://www.apache.org/licenses/LICENSE-2.0)

## Credits

Mapbox for their [vector tile spec](https://github.com/mapbox/vector-tile-spec),
Google for their [Protocol Buffers](https://code.google.com/p/protobuf/) and
Dr JTS and LocationTech for [JTS](https://github.com/locationtech/jts)