> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GeoDataFrame.to_arrow

> Encode a GeoDataFrame to GeoArrow format.

Encode a GeoDataFrame to GeoArrow format.
See [https://geoarrow.org/](https://geoarrow.org/) for details on the GeoArrow specification.
This function returns a generic Arrow data object implementing
the `Arrow PyCapsule Protocol`\_ (i.e. having an `__arrow_c_stream__`
method). This object can then be consumed by your Arrow implementation
of choice that supports this protocol.
.. \_Arrow PyCapsule Protocol: [https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html](https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html)

Note: Requires geopandas versions >= 1.0.0 to use with Sedona.

## Parameters

index : bool, default None
If `True`, always include the dataframe's index(es) as columns
in the file output.
If `False`, the index(es) will not be written to the file.
If `None`, the index(ex) will be included as columns in the file
output except `RangeIndex` which is stored as metadata only.

Note: Unlike in geopandas, `None` will include the index in the column because Sedona always
converts `RangeIndex` into a general `Index`.

interleaved : bool, default True
Only relevant for 'geoarrow' encoding. If True, the geometries'
coordinates are interleaved in a single fixed size list array.
If False, the coordinates are stored as separate arrays in a
struct type.
include\_z : bool, default None
Only relevant for 'geoarrow' encoding (for WKB, the dimensionality
of the individual geometries is preserved).
If False, return 2D geometries. If True, include the third dimension
in the output (if a geometry has no third dimension, the z-coordinates
will be NaN). By default, will infer the dimensionality from the
input geometries. Note that this inference can be unreliable with
empty geometries (for a guaranteed result, it is recommended to
specify the keyword).
Returns
-------

ArrowTable
A generic Arrow table object with geometry columns encoded to
GeoArrow.
Examples
--------

```python theme={"system"}
>>> from sedona.spark.geopandas import GeoDataFrame
>>> from shapely.geometry import Point
>>> data = {'col1': ['name1', 'name2'], 'geometry': [Point(1, 2), Point(2, 1)]}
>>> gdf = GeoDataFrame(data)
>>> gdf
col1     geometry
0  name1  POINT (1 2)
1  name2  POINT (2 1)
>>> arrow_table = gdf.to_arrow(index=False)
>>> arrow_table
<geopandas.io._geoarrow.ArrowTable object at ...>
The returned data object needs to be consumed by a library implementing
the Arrow PyCapsule Protocol. For example, wrapping the data as a
pyarrow.Table (requires pyarrow >= 14.0):
>>> import pyarrow as pa  # requires: pip install pyarrow
>>> table = pa.table(arrow_table)
>>> table
pyarrow.Table
col1: string
geometry: binary
----
col1: [["name1","name2"]]
geometry: [[0101000000000000000000F03F0000000000000040,01010000000000000000000040000000000000F03F]]
```

## Signature

```python theme={"system"}
to_arrow(
    *,
    index: bool | None = None,
    geometry_encoding='WKB',
    interleaved: bool = True,
    include_z: bool | None = None,
)
```

## Parameters

<ParamField path="index" type="bool | None" default="None" />

<ParamField path="geometry_encoding" default="'WKB'" />

<ParamField path="interleaved" type="bool" default="True" />

<ParamField path="include_z" type="bool | None" default="None" />

**\{'WKB', 'geoarrow' }, default 'WKB'**

The GeoArrow encoding to use for the data conversion.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.