(Geo)Parquet

New in version 3.5.

Driver short name

Parquet

Build dependencies

Parquet component of the Apache Arrow C++ library

From https://parquet.apache.org/: "Apache Parquet is an open source, column-oriented data file format designed for efficient data storage and retrieval. It provides efficient data compression and encoding schemes with enhanced performance to handle complex data in bulk. Parquet is available in multiple languages including Java, C++, Python, etc..."

This driver also supports geometry columns using the GeoParquet specification.

Note

The driver should be considered experimental as the GeoParquet specification is not finalized yet.

The GeoParquet 1.0.0 specification is supported since GDAL 3.8.0

Driver capabilities

Supports Create()

This driver supports the GDALDriver::Create() operation

Supports Georeferencing

This driver supports georeferencing

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

Open options

  • GEOM_POSSIBLE_NAMES=value: (GDAL >= 3.8) Defaults to geometry,wkb_geometry,wkt_geometry. Comma separated list of possible names for geometry column(s). Only used for files without GeoParquet dataset-level metadata. Columns are recognized as geometry columns only if they are of type binary (they are assumed to contain WKB encoded geometries), or if they are of type string and contain the "wkt" substring in their name (they are then assumed to contain WKT encoded geometries).

  • CRS=value: (GDAL >= 3.8) To set or override the CRS of geometry columns. The string is typically formatted as CODE:AUTH (e.g "EPSG:4326"), or can be a PROJ.4 or WKT CRS string.

Creation issues

The driver supports creating only a single layer in a dataset.

Layer creation options

  • COMPRESSION=[NONE/UNCOMPRESSED/SNAPPY/GZIP/BROTLI/ZSTD/LZ4_RAW/LZ4_HADOOP]:

    Compression method. Available values depend on how the Parquet library was compiled. Defaults to SNAPPY when available, otherwise NONE.

  • GEOMETRY_ENCODING=[WKB/WKT/GEOARROW]: Defaults to WKB. Geometry encoding. Other encodings (WKT and GEOARROW) are not allowed by the GeoParquet specification, but are handled as an extension, for symmetry with the Arrow driver.

  • ROW_GROUP_SIZE=<integer>: Defaults to 65536. Maximum number of rows per group.

  • GEOMETRY_NAME=value: Defaults to geometry. Name of geometry column.

  • FID=value: Name of the FID (Feature Identifier) column to create. If none is specified, no FID column is created. Note that if using ogr2ogr with the Parquet driver as the target driver and a source layer that has a named FID column, this FID column name will be automatically used to set the FID layer creation option of the Parquet driver (unless -lco FID= is used to set an empty name)

  • POLYGON_ORIENTATION=[COUNTERCLOCKWISE/UNMODIFIED]: Defaults to COUNTERCLOCKWISE. Whether exterior rings of polygons should be counterclockwise oriented (and interior rings clockwise oriented), or left to their original orientation.

  • EDGES=[PLANAR/SPHERICAL]: Defaults to PLANAR. How to interpret the edges of the geometries: whether the line between two points is a straight cartesian line (PLANAR) or the shortest line on the sphere (geodesic line) (SPHERICAL).

  • CREATOR=value: Name of creating application.

  • WRITE_COVERING_BBOX=[YES/NO]: (GDAL >= 3.9) Defaults to YES. Whether to write xmin/ymin/xmax/ymax columns with the bounding box of geometries.

  • SORT_BY_BBOX=[YES/NO]: (GDAL >= 3.9) Defaults to NO. Whether features should be sorted based on the bounding box of their geometries, before being written in the final file. Sorting them enables faster spatial filtering on reading, by grouping together spatially close features in the same group of rows.

    Note however that enabling this option involves creating a temporary GeoPackage file (in the same directory as the final Parquet file), and thus requires temporary storage (possibly up to several times the size of the final Parquet file, depending on Parquet compression) and additional processing time.

    The efficiency of spatial filtering depends on the ROW_GROUP_SIZE. If it is too large, too many features that are not spatially close will be grouped together. If it is too small, the file size will increase, and extra processing time will be necessary to browse through the row groups.

    Note also that when this option is enabled, the Arrow writing API (which is for example triggered when using ogr2ogr to convert from Parquet to Parquet), fallbacks to the generic implementation, which does not support advanced Arrow types (lists, maps, etc.).

SQL support

SQL statements are run through the OGR SQL engine. Statistics can be used to speed-up evaluations of SQL requests like: "SELECT MIN(colname), MAX(colname), COUNT(colname) FROM layername"

Dataset/partitioning read support

Starting with GDAL 3.6.0, the driver can read directories that contain several Parquet files, and expose them as a single layer. This support is only enabled if the driver is built against the arrowdataset C++ library.

Note that no optimization is currently done regarding filtering.

Metadata

New in version 3.9.0.

Layer metadata can be read and written. It is serialized as JSON content in a gdal:metadata domain.

Multithreading

Starting with GDAL 3.6.0, the driver will use up to 4 threads for reading (or the maximum number of available CPUs returned by CPLGetNumCPUs() if it is lower by 4). This number can be configured with the configuration option GDAL_NUM_THREADS, which can be set to an integer value or ALL_CPUS.

Validation script

The validate_geoparquet.py Python script can be used to check compliance of a Parquet file against the GeoParquet specification.

To validate only metadata:

python3 validate_geoparquet.py my_geo.parquet

To validate metadata and check content of geometry column(s):

python3 validate_geoparquet.py --check-data my_geo.parquet

Conda-forge package

The driver can be installed as a plugin for the libgdal conda-forge package with:

conda install -c conda-forge libgdal-arrow-parquet