Class GeoparquetDatasetMetadata
- Object
-
- GeoparquetDatasetMetadata
-
public class GeoparquetDatasetMetadata extends Object
Represents metadata for an entire GeoParquet dataset, which may contain multiple files.This class collects and aggregates metadata from all files in a dataset, providing unified access to bounds, CRS information, and other dataset-wide properties. When dealing with a directory of GeoParquet files, this class provides a consolidated view of the metadata across all files.
Key functionality includes:
- Computing unified bounds across all files in the dataset
- Providing access to CRS information
- Supporting directory-based datasets with multiple GeoParquet files
-
-
Constructor Summary
Constructors Constructor Description GeoparquetDatasetMetadata(Map<String,GeoParquetMetadata> md)
Creates a new dataset metadata instance from a map of individual file metadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReferencedEnvelope
getBounds()
Optional<Geometry>
getColumn(String column)
CoordinateReferenceSystem
getCrs()
Gets the CRS for the primary geometry column in the dataset.CoordinateReferenceSystem
getCrs(String columnName)
Gets the CRS for a specific geometry column in the dataset.Set<Class<? extends Geometry>>
getGeometryTypes(String column)
Gets the set of all geometry types present in a column across the dataset.Class<? extends Geometry>
getNarrowedGeometryType(String column)
Determines the most specific geometry type for a geometry column.Optional<Geometry>
getPrimaryColumn()
Optional<String>
getPrimaryColumnName()
boolean
isEmpty()
-
-
-
Constructor Detail
-
GeoparquetDatasetMetadata
public GeoparquetDatasetMetadata(Map<String,GeoParquetMetadata> md)
Creates a new dataset metadata instance from a map of individual file metadata.- Parameters:
md
- Map of file names to their GeoParquet metadata
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
getNarrowedGeometryType
public Class<? extends Geometry> getNarrowedGeometryType(String column)
Determines the most specific geometry type for a geometry column.This method analyzes the geometry types present in the dataset for the specified column and returns the most specific common supertype. The process follows these steps:
- If no types are available, return the generic Geometry class
- If only one type is present, return that type
- If the generic Geometry class is present, return that
- If multiple base types are present (point, line, polygon), return GeometryCollection or Geometry
- For each specialized type (point, line, polygon), return the most specific common type
For example, if both Point and MultiPoint are present, the method will return the Puntal interface or MultiPoint class. If only LineString is present, it will return LineString.
- Parameters:
column
- The geometry column name to get the narrowed type for- Returns:
- The most specific common geometry type for the column
-
getGeometryTypes
public Set<Class<? extends Geometry>> getGeometryTypes(String column)
Gets the set of all geometry types present in a column across the dataset.This method aggregates the geometry types from all files in the dataset for the specified column. If no column name is provided, it uses the primary geometry column from the GeoParquet metadata.
The results are cached for performance to avoid repeated computation.
- Parameters:
column
- The name of the geometry column to get types for, or null to use the primary column- Returns:
- A set of geometry classes representing all types present in the column
-
getCrs
public CoordinateReferenceSystem getCrs()
Gets the CRS for the primary geometry column in the dataset.This method extracts the CRS information from the GeoParquet metadata's 'geo' field for the primary geometry column. The CRS is represented in PROJJSON format (v0.7 schema) with proper handling of CRS identifiers with authority and code properties.
The implementation converts the PROJJSON representation to a GeoTools CoordinateReferenceSystem object for use with GeoTools spatial operations.
- Returns:
- The CRS from the primary geometry column, or EPSG:4326 if not available
-
getCrs
public CoordinateReferenceSystem getCrs(String columnName)
Gets the CRS for a specific geometry column in the dataset.This method extracts the CRS information from the GeoParquet metadata's 'geo' field for the specified geometry column. The CRS is represented in PROJJSON format (v0.7 schema) with proper handling of CRS identifiers with authority and code properties.
The implementation converts the PROJJSON representation to a GeoTools CoordinateReferenceSystem object for use with GeoTools spatial operations.
This allows for supporting multiple geometry columns with different CRS in the same dataset.
- Parameters:
columnName
- Name of the column to get CRS for- Returns:
- The CRS for the specified column, or EPSG:4326 if not available
-
getBounds
public ReferencedEnvelope getBounds()
-
-