client.choose_format

client.choose_format(
    vectorfile_format,
    year,
    force=False,
    parquet_exists=None,
    geojson_exists=None,
)

Format of the files to read.

GeoParquet is used whenever it exists (from 2025 onwards, and for the earlier years it has been produced for): only the needed parts of the file are downloaded, which is as fast as GeoJSON for a small request and much faster for a large one. GeoJSON is only read when there is no GeoParquet, or when explicitly requested with force=True for a year that has GeoJSON files: none is published from 2025 onwards.

Parameters

Name Type Description Default
vectorfile_format str “auto”, “geojson”, “parquet” or “geoparquet”. required
year int or str Vintage. required
force bool Read GeoJSON when requested even if GeoParquet exists, provided GeoJSON files exist for the year. False
parquet_exists bool Whether GeoParquet exists (see parquet_available). By default, deduced from the year only: from 2025 onwards. None
geojson_exists bool Whether GeoJSON files exist (see geojson_available). By default, deduced from the year only: before 2025. None

Returns

Name Type Description
str “parquet” or “geojson”.

Notes

A UserWarning is emitted when GeoJSON is requested and GeoParquet exists: either GeoParquet is read instead (force=False, or no GeoJSON file for the year), or GeoJSON is read but is slower (force=True).

Examples

>>> choose_format("auto", 2025)
'parquet'
>>> choose_format("auto", 2022)
'geojson'
Retour au sommet