Interoperability¶
Interoperability with other in-memory Python
geoarrow.rust.core ¶
from_ewkb
builtin
¶
from_ewkb(input: ArrowArrayExportable) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
Parse an Arrow BinaryArray from EWKB to its GeoArrow-native counterpart.
Parameters:
-
input
(ArrowArrayExportable
) –An Arrow array of Binary type holding EWKB-formatted geometries.
Returns:
-
PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
–A GeoArrow-native geometry array
from_geopandas
builtin
¶
from_geopandas(input: gpd.GeoDataFrame) -> GeoTable
Create a GeoArrow Table from a GeoPandas GeoDataFrame.
Notes:¶
- Currently this will always generate a non-chunked GeoArrow array. This is partly because pyarrow.Table.from_pandas always creates a single batch.
- This requires
pyarrow
version 14 or later.
Parameters:
-
input
(GeoDataFrame
) –
Returns:
-
GeoTable
–A GeoArrow Table
from_shapely
builtin
¶
from_shapely(input) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray
Create a GeoArrow array from an array of Shapely geometries.
Notes:¶
- Currently this will always generate a non-chunked GeoArrow array. Use the
from_shapely
method on a chunked GeoArrow array class to construct a chunked array. - This will first call
to_ragged_array
, falling back toto_wkb
if necessary. If you know you have mixed-type geometries in your column, useMixedGeometryArray.from_shapely
.
This is because to_ragged_array
is the fastest approach but fails on mixed-type geometries.
It supports combining Multi-* geometries with non-multi-geometries in the same array, so you
can combine e.g. Point and MultiPoint geometries in the same array, but to_ragged_array
doesn't work if you have Point and Polygon geometries in the same array.
Args:
input: Any array object accepted by Shapely, including numpy object arrays and
geopandas.GeoSeries
.
Returns:
A GeoArrow array
from_wkb
builtin
¶
from_wkb(input: ArrowArrayExportable) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
Parse an Arrow BinaryArray from WKB to its GeoArrow-native counterpart.
This expects ISO-formatted WKB geometries.
Parameters:
-
input
(ArrowArrayExportable
) –An Arrow array of Binary type holding WKB-formatted geometries.
Returns:
-
PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
–A GeoArrow-native geometry array
from_wkt
builtin
¶
from_wkt(input: ArrowArrayExportable) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
Parse an Arrow StringArray from WKT to its GeoArrow-native counterpart.
Parameters:
-
input
(ArrowArrayExportable
) –An Arrow array of string type holding WKT-formatted geometries.
Returns:
-
PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray | MixedGeometryArray | GeometryCollectionArray
–A GeoArrow-native geometry array
to_geopandas
builtin
¶
to_geopandas(input: ArrowStreamExportable) -> gpd.GeoDataFrame
Convert a GeoArrow Table to a GeoPandas GeoDataFrame.
Notes:¶
- This requires [
pyarrow
][pyarrow] version 14 or later.
Parameters:
-
input
(ArrowStreamExportable
) –A GeoArrow Table.
Returns:
-
GeoDataFrame
–the converted GeoDataFrame
to_shapely
builtin
¶
to_shapely(input: ArrowArrayExportable) -> NDArray[np.object_]
Convert a GeoArrow array to a numpy array of Shapely objects
Parameters:
-
input
(ArrowArrayExportable
) –input geometry array
Returns:
to_wkb
builtin
¶
to_wkb(input: ArrowArrayExportable) -> WKBArray
Encode a GeoArrow-native geometry array to a WKBArray, holding ISO-formatted WKB geometries.
Parameters:
-
input
(ArrowArrayExportable
) –A GeoArrow-native geometry array
Returns:
-
WKBArray
–An array with WKB-formatted geometries