public static GeoParquetMetadata parse(FileMetaData metadata) throws IOException {
    String string = metadata.getKeyValueMetaData().get("geo");
    if (string != null) {
      try {
        return mapper.readValue(string, GeoParquetMetadata.class);
      } catch (JsonProcessingException e) {
        LOGGER.warn("Invalid geoparquet metadata", e);
      }
    }
    // fallback
    for (var field : metadata.getSchema().asGroupType().getFields()) {
      if (field.isPrimitive() &&
        field.asPrimitiveType().getPrimitiveTypeName() == PrimitiveType.PrimitiveTypeName.BINARY) {
        switch (field.getName()) {
          case "geometry", "wkb_geometry" -> {
            return new GeoParquetMetadata("1.0.0", field.getName(), Map.of(
              field.getName(), new ColumnMetadata("WKB")));
          }
          case "wkt_geometry" -> {
            return new GeoParquetMetadata("1.0.0", field.getName(), Map.of(
              field.getName(), new ColumnMetadata("WKT")));
          }
          default -> {
            //ignore
          }
        }
      }
    }
    throw new IOException(
      "No valid geometry columns found: " + metadata.getSchema().asGroupType().getFields().stream().map(
        Type::getName).toList());
  }
Extracts geoparquet metadata from the {@code "geo"} key value metadata field for the file, or tries to generate a
default one if missing that uses geometry, wkb_geometry, or wkt_geometry column.
planetiler-core/src/main/java/com/onthegomap/planetiler/reader/parquet/GeoParquetMetadata.java