Skip to main content

read_parquet_file

Function read_parquet_file 

Source
pub fn read_parquet_file(
    path: &Path,
    overture_type: OvertureType,
    bbox: Option<&Bbox>,
    emit: impl FnMut(InputFeature),
) -> Result<u64, GeolithError>
Expand description

Read all features from a Parquet file, passing each to emit.

Row groups are filtered by bbox (if provided): by the bbox covering column’s statistics when the file has one (Overture, GeoParquet 1.1), else by the native GEOMETRY column’s geospatial statistics (GeoParquet 2.0). Features are decoded one batch at a time and immediately emitted — nothing is accumulated in memory. Of the names.common map only the languages of crate::names are kept, as names.common.<lang> properties.

§Errors

Every error names the file (reading the Parquet file <path>). GeolithError::Io when the file cannot be opened, and GeolithError::Parquet or GeolithError::Arrow when a row group or a batch cannot be decoded. GeolithError::ParquetGeometry when the file has no geometry column or it is not Binary. GeolithError::BadWkb when more than MAX_BAD_WKB_PER_FILE geometries are not valid WKB, or when the file has bad geometries and no valid one.