Skip to content

GeoJSON

Read and write GeoJSON and newline-delimited GeoJSON files.

geoarrow.rust.io.read_geojson

read_geojson(
    file: Union[str, Path, BinaryIO], *, batch_size: int = 65536
) -> Table

Read a GeoJSON file from a path on disk into an Arrow Table.

Parameters:

  • file (Union[str, Path, BinaryIO]) –

    the path to the file or a Python file object in binary read mode.

  • batch_size (int, default: 65536 ) –

    the number of rows to include in each internal batch of the table.

Returns:

  • Table

    Table from GeoJSON file.

geoarrow.rust.io.read_geojson_lines

read_geojson_lines(
    file: Union[str, Path, BinaryIO], *, batch_size: int = 65536
) -> Table

Read a newline-delimited GeoJSON file from a path on disk into an Arrow Table.

This expects a GeoJSON Feature on each line of a text file, with a newline character separating each Feature.

Parameters:

  • file (Union[str, Path, BinaryIO]) –

    the path to the file or a Python file object in binary read mode.

  • batch_size (int, default: 65536 ) –

    the number of rows to include in each internal batch of the table.

Returns:

  • Table

    Table from GeoJSON file.

geoarrow.rust.io.write_geojson

write_geojson(
    table: ArrowStreamExportable, file: Union[str, Path, BinaryIO]
) -> None

Write to a GeoJSON file on disk.

Note that the GeoJSON specification mandates coordinates to be in the WGS84 (EPSG:4326) coordinate system, but this function will not automatically reproject into WGS84 for you.

Parameters:

Returns:

  • None

    None

geoarrow.rust.io.write_geojson_lines

write_geojson_lines(
    table: ArrowStreamExportable, file: Union[str, Path, BinaryIO]
) -> None

Write to a newline-delimited GeoJSON file on disk.

Note that the GeoJSON specification mandates coordinates to be in the WGS84 (EPSG:4326) coordinate system, but this function will not automatically reproject into WGS84 for you.

Parameters:

Returns:

  • None

    None