public VectorTileProto.Tile toProto() {
    VectorTileProto.Tile.Builder tile = VectorTileProto.Tile.newBuilder();
    for (Map.Entry<String, Layer> e : layers.entrySet()) {
      String layerName = e.getKey();
      Layer layer = e.getValue();

      VectorTileProto.Tile.Layer.Builder tileLayer = VectorTileProto.Tile.Layer.newBuilder()
        .setVersion(2)
        .setName(layerName)
        .setExtent(EXTENT)
        .addAllKeys(layer.keys());

      for (Object value : layer.values()) {
        VectorTileProto.Tile.Value.Builder tileValue = VectorTileProto.Tile.Value.newBuilder();
        switch (value) {
          case String stringValue -> tileValue.setStringValue(stringValue);
          case Integer intValue -> tileValue.setSintValue(intValue);
          case Long longValue -> tileValue.setSintValue(longValue);
          case Float floatValue -> tileValue.setFloatValue(floatValue);
          case Double doubleValue -> tileValue.setDoubleValue(doubleValue);
          case Boolean booleanValue -> tileValue.setBoolValue(booleanValue);
          case Object other -> tileValue.setStringValue(other.toString());
        }
        tileLayer.addValues(tileValue.build());
      }

      for (EncodedFeature feature : layer.encodedFeatures) {
        VectorTileProto.Tile.Feature.Builder featureBuilder = VectorTileProto.Tile.Feature.newBuilder()
          .addAllTags(Ints.asList(feature.tags.toArray()))
          .setType(feature.geometry().geomType().asProtobufType())
          .addAllGeometry(Ints.asList(feature.geometry().commands()));

        if (feature.id != NO_FEATURE_ID) {
          featureBuilder.setId(feature.id);
        }

        tileLayer.addFeatures(featureBuilder.build());
      }

      tile.addLayers(tileLayer.build());
    }
    return tile.build();
  }
Returns a vector tile protobuf object with all features in this tile.
planetiler-core/src/main/java/com/onthegomap/planetiler/VectorTile.java