public Function<TileCoord, Path> encoder() {
    final boolean xSafe = tileScheme.contains(X_SAFE_TEMPLATE);
    final boolean ySafe = tileScheme.contains(Y_SAFE_TEMPLATE);
    return tileCoord -> {

      String p = tileScheme.replace(Z_TEMPLATE, Integer.toString(tileCoord.z()));

      if (xSafe) {
        final String colStr = String.format("%06d", tileCoord.x());
        p = p.replace(X_SAFE_TEMPLATE, Paths.get(colStr.substring(0, 3), colStr.substring(3)).toString());
      } else {
        p = p.replace(X_TEMPLATE, Integer.toString(tileCoord.x()));
      }

      if (ySafe) {
        final String rowStr = String.format("%06d", tileCoord.y());
        p = p.replace(Y_SAFE_TEMPLATE, Paths.get(rowStr.substring(0, 3), rowStr.substring(3)).toString());
      } else {
        p = p.replace(Y_TEMPLATE, Integer.toString(tileCoord.y()));
      }

      return basePath.resolve(Paths.get(p));
    };
  }
@param tileScheme the tile scheme to use e.g. {z}/{x}/{y}.pbf
@param basePath   the base path to append the generated relative tile path to
planetiler-core/src/main/java/com/onthegomap/planetiler/files/TileSchemeEncoding.java