GeoParquet Class
Reads GeoParquet files (versions 1.0 and 1.1): Parquet files whose geo metadata describes a geometry column encoded as WKB, as GDAL, GeoPandas, DuckDB and the cloud data catalogs write them.
public static class GeoParquetRemarks
The geometries are read as WellKnownBinary reads them, with their altitudes (Z) and measures (M). A null or empty geometry gives a feature without geometry. The geometry columns encoded with the native (GeoArrow) encodings throw a FormatException. The coordinate system of the column is not read: the coordinates are expected to be longitudes and latitudes (OGC:CRS84, the default of GeoParquet), and are not converted otherwise.
The properties are the other top-level columns, with the .NET type of the column, such as an Int32, a Int64, a Double, a String, a DateTime or an array of bytes. A null value is not a property. The columns of structures, lists and maps, such as the bbox covering column, are not read. The features have no identifier.
The Parquet files are read without dependency: the pages of versions 1 and 2, with the PLAIN, dictionary, RLE, delta and BYTE_STREAM_SPLIT encodings, uncompressed or compressed with Snappy, GZIP, Brotli, LZ4 or Zstandard. Zstandard needs .NET 11 or later: on .NET 10, such a file throws a NotSupportedException, as do LZO, encrypted files and column chunks stored in other files.
The file is read one row group at a time: the memory holds the columns of a row group, not the whole file. With GeoParquetReaderOptions.Bounds, the row groups whose bbox covering statistics are outside of the box are skipped.
Methods
| Name | Description |
|---|---|
| ReadAsync(Stream, GeoParquetReaderOptions?, CancellationToken) | Reads the features of GeoParquet data from a stream. |
| ReadAsync(string, GeoParquetReaderOptions?, CancellationToken) | Reads the features of a GeoParquet file. |
| ReadFeaturesAsync(Stream, GeoParquetReaderOptions?, CancellationToken) | Reads the features of GeoParquet data from a stream one row group at a time, with bounded memory: the columns of a row group are read when its features are enumerated. |
| ReadFeaturesAsync(string, GeoParquetReaderOptions?, CancellationToken) | Reads the features of a GeoParquet file one row group at a time, with bounded memory: the columns of a row group are read when its features are enumerated. |
ReadAsync overloads
ReadAsync(Stream, GeoParquetReaderOptions?, CancellationToken)
GeoParquet.csReads the features of GeoParquet data from a stream.
net10.0
public static Task<GeoFeatureCollection> ReadAsync(Stream stream, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)net11.0
public static Task<GeoFeatureCollection> ReadAsync(Stream stream, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)Parameters
streamStream- The data. It must be seekable, to read the metadata at its end. It is left open.
optionsGeoParquetReaderOptions?- The options, or
nullfor the defaults. cancellationTokenCancellationToken- The token to cancel the reading.
Returns
Task<GeoFeatureCollection> The features, in the order of the data.
Exceptions
ArgumentException- The data has no geometry column named
GeoParquetReaderOptions.GeometryColumn. FormatException- The data is not valid GeoParquet, its geometry column is not encoded as WKB, or a geometry is not valid.
NotSupportedException- The stream cannot seek, or the file uses a feature that is not supported: Zstandard on .NET 10, LZO, encryption, or column chunks in other files.
ReadAsync(string, GeoParquetReaderOptions?, CancellationToken)
GeoParquet.csReads the features of a GeoParquet file.
net10.0
public static Task<GeoFeatureCollection> ReadAsync(string path, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)net11.0
public static Task<GeoFeatureCollection> ReadAsync(string path, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)Parameters
pathstring- The path of the file.
optionsGeoParquetReaderOptions?- The options, or
nullfor the defaults. cancellationTokenCancellationToken- The token to cancel the reading.
Returns
Task<GeoFeatureCollection> The features, in the order of the file, in a collection named after the file, without its extension.
Exceptions
ArgumentException- The file has no geometry column named
GeoParquetReaderOptions.GeometryColumn. FormatException- The file is not a valid GeoParquet file, its geometry column is not encoded as WKB, or a geometry is not valid.
NotSupportedException- The file uses a feature that is not supported: Zstandard on .NET 10, LZO, encryption, or column chunks in other files.
ReadFeaturesAsync overloads
ReadFeaturesAsync(Stream, GeoParquetReaderOptions?, CancellationToken)
GeoParquet.csReads the features of GeoParquet data from a stream one row group at a time, with bounded memory: the columns of a row group are read when its features are enumerated.
public static IAsyncEnumerable<GeoFeature> ReadFeaturesAsync(Stream stream, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)Parameters
streamStream- The data. It must be seekable, to read the metadata at its end. It is left open.
optionsGeoParquetReaderOptions?- The options, or
nullfor the defaults. cancellationTokenCancellationToken- The token to cancel the reading.
Returns
IAsyncEnumerable<GeoFeature> The features, in the order of the data.
Exceptions
ArgumentException- The data has no geometry column named
GeoParquetReaderOptions.GeometryColumn. FormatException- The data is not valid GeoParquet, its geometry column is not encoded as WKB, or a geometry is not valid. The features read before the error are returned first.
NotSupportedException- The stream cannot seek, or the file uses a feature that is not supported: Zstandard on .NET 10, LZO, encryption, or column chunks in other files.
ReadFeaturesAsync(string, GeoParquetReaderOptions?, CancellationToken)
GeoParquet.csReads the features of a GeoParquet file one row group at a time, with bounded memory: the columns of a row group are read when its features are enumerated.
public static IAsyncEnumerable<GeoFeature> ReadFeaturesAsync(string path, GeoParquetReaderOptions? options = null, CancellationToken cancellationToken = default)Parameters
pathstring- The path of the file.
optionsGeoParquetReaderOptions?- The options, or
nullfor the defaults. cancellationTokenCancellationToken- The token to cancel the reading.
Returns
IAsyncEnumerable<GeoFeature> The features, in the order of the file. The file is opened when the enumeration starts, and closed when it ends.
Exceptions
ArgumentException- The file has no geometry column named
GeoParquetReaderOptions.GeometryColumn. FormatException- The file is not a valid GeoParquet file, its geometry column is not encoded as WKB, or a geometry is not valid. The features read before the error are returned first.
NotSupportedException- The file uses a feature that is not supported: Zstandard on .NET 10, LZO, encryption, or column chunks in other files.