Class GeoParquetMetadata

Object
GeoParquetMetadata
Direct Known Subclasses:
GeoParquetMetadataV1_1_0, GeoParquetMetadataV1_2_0Dev

public abstract class GeoParquetMetadata extends Object
Base class for GeoParquet metadata, representing the common structure of the "geo" metadata field in a GeoParquet file. This includes the version, primary geometry column, and column metadata. Subclasses define specific version constraints (e.g., 1.1.0, 1.2.0-dev).

The GeoParquet metadata is stored as a key-value metadata entry in the Parquet file, with the key "geo" and the value being a JSON string. This class and its subclasses provide the object mapping for that JSON data structure, following the GeoParquet specification.

Key components of the metadata include:

  • Specification version (e.g., "1.1.0")
  • Primary geometry column name
  • Geometry encoding details
  • Geometry types supported in each geometry column
  • CRS information
  • Bounding box data
  • Optional covering information for spatial indexing

This implementation handles deserialization of the metadata and provides access to its various components, enabling optimized operations such as bounds calculation and schema detection.

See Also:
  • Field Details

  • Constructor Details

    • GeoParquetMetadata

      public GeoParquetMetadata()
  • Method Details

    • readValue

      public static GeoParquetMetadata readValue(String geo) throws IOException
      Reads GeoParquet metadata from a JSON string.
      Parameters:
      geo - the JSON string containing the metadata
      Returns:
      the parsed GeoParquetMetadata object
      Throws:
      IOException - if the JSON cannot be parsed
    • bounds

      public Envelope bounds()
      Gets the bounds of the primary geometry column.
      Returns:
      The envelope representing the bounds of the primary geometry column, or an empty envelope if bounds are not available
    • getVersion

      public String getVersion()
      Gets the GeoParquet specification version.
      Returns:
      the version string
    • setVersion

      public void setVersion(String version)
      Sets the GeoParquet specification version.
      Parameters:
      version - the version string
    • getPrimaryColumn

      public String getPrimaryColumn()
      Gets the name of the primary geometry column.
      Returns:
      the primary column name
    • setPrimaryColumn

      public void setPrimaryColumn(String primaryColumn)
      Sets the name of the primary geometry column (must be non-empty).
      Parameters:
      primaryColumn - the primary column name
    • getColumn

      public Optional<Geometry> getColumn(String column)
      Gets the geometry metadata for a specific column.
      Parameters:
      column - the name of the column
      Returns:
      an Optional containing the column's geometry metadata, or empty if the column doesn't exist
    • getColumns

      public Map<String,Geometry> getColumns()
      Gets the column metadata, mapping column names to their geometry details.
      Returns:
      a map of column names to geometry metadata
    • setColumns

      public void setColumns(Map<String,Geometry> columns)
      Sets the column metadata (must contain at least one entry).
      Parameters:
      columns - a map of column names to geometry metadata