Functions¶
Interoperability with other Python geospatial libraries (Shapely, GeoPandas) and in-memory geospatial formats (WKB, WKT).
geoarrow.rust.core.from_wkb ¶
from_wkb(
input: ArrowArrayExportable, to_type: ArrowSchemaExportable | None = None
) -> GeoArray
from_wkb(
input: ArrowStreamExportable, to_type: ArrowSchemaExportable | None = None
) -> GeoArrayReader
from_wkb(
input: ArrowArrayExportable | ArrowStreamExportable,
to_type: ArrowSchemaExportable | None = None,
) -> GeoArray | GeoArrayReader
Parse the WKB input to the provided data type.
Parameters:
-
input(ArrowArrayExportable | ArrowStreamExportable) –Input data to parse.
-
to_type(ArrowSchemaExportable | None, default:None) –The target data type to parse to. By default, parses to a Geometry type array (the output of
geoarrow.rust.core.geometry).
Returns:
-
GeoArray | GeoArrayReader–If
inputis an Array-like, aGeoArraywill be returned. Ifinputis a Stream-like (ChunkedArrayorArrayReader), aGeoArrayReaderwill be returned.
geoarrow.rust.core.from_wkt ¶
from_wkt(
input: ArrowArrayExportable, to_type: ArrowSchemaExportable | None = None
) -> GeoArray
from_wkt(
input: ArrowStreamExportable, to_type: ArrowSchemaExportable | None = None
) -> GeoArrayReader
from_wkt(
input: ArrowArrayExportable | ArrowStreamExportable,
to_type: ArrowSchemaExportable | None = None,
) -> GeoArray | GeoArrayReader
Parse the WKT input to the provided data type.
Parameters:
-
input(ArrowArrayExportable | ArrowStreamExportable) –Input data to parse.
-
to_type(ArrowSchemaExportable | None, default:None) –The target data type to parse to. By default, parses to a Geometry type array (the output of
geoarrow.rust.core.geometry).
Returns:
-
GeoArray | GeoArrayReader–If
inputis an Array-like, aGeoArraywill be returned. Ifinputis a Stream-like (ChunkedArrayorArrayReader), aGeoArrayReaderwill be returned.
geoarrow.rust.core.to_wkb ¶
to_wkb(
input: ArrowArrayExportable,
wkb_type: Literal["wkb", "large_wkb", "wkb_view"] = "wkb",
) -> GeoArray
to_wkb(
input: ArrowStreamExportable,
wkb_type: Literal["wkb", "large_wkb", "wkb_view"] = "wkb",
) -> GeoArrayReader
to_wkb(
input: ArrowArrayExportable | ArrowStreamExportable,
wkb_type: Literal["wkb", "large_wkb", "wkb_view"] = "wkb",
) -> GeoArray | GeoArrayReader
Convert input to WKB.
Parameters:
-
input(ArrowArrayExportable | ArrowStreamExportable) –Input data to parse.
-
wkb_type(Literal['wkb', 'large_wkb', 'wkb_view'], default:'wkb') –The target WKB array type to convert to. Can be one of "wkb" (binary array with
i32offsets), "large_wkb" (binary array withi64offsets), or "wkb_view" (binary view array).
Returns:
-
GeoArray | GeoArrayReader–If
inputis an Array-like, aGeoArraywill be returned. Ifinputis a Stream-like (ChunkedArrayorArrayReader), aGeoArrayReaderwill be returned.
geoarrow.rust.core.to_wkt ¶
to_wkt(
input: ArrowArrayExportable,
wkt_type: Literal["wkt", "large_wkt", "wkt_view"] = "wkt",
) -> GeoArray
to_wkt(
input: ArrowStreamExportable,
wkt_type: Literal["wkt", "large_wkt", "wkt_view"] = "wkt",
) -> GeoArrayReader
to_wkt(
input: ArrowArrayExportable | ArrowStreamExportable,
wkt_type: Literal["wkt", "large_wkt", "wkt_view"] = "wkt",
) -> GeoArray | GeoArrayReader
Convert input to WKT.
Parameters:
-
input(ArrowArrayExportable | ArrowStreamExportable) –Input data to parse.
-
wkt_type(Literal['wkt', 'large_wkt', 'wkt_view'], default:'wkt') –The target WKT array type to convert to. Can be one of "wkt" (string array with
i32offsets), "large_wkt" (string array withi64offsets), or "wkt_view" (string view array).
Returns:
-
GeoArray | GeoArrayReader–If
inputis an Array-like, aGeoArraywill be returned. Ifinputis a Stream-like (ChunkedArrayorArrayReader), aGeoArrayReaderwill be returned.
geoarrow.rust.core.get_crs ¶
get_crs(
data: ArrowArrayExportable | ArrowStreamExportable | ArrowSchemaExportable,
/,
column: str | None = None,
) -> CRS | None
Get the CRS from a GeoArrow object.
Parameters:
-
data(ArrowArrayExportable | ArrowStreamExportable | ArrowSchemaExportable) –A GeoArrow object. This can be an Array, ChunkedArray, ArrayReader, RecordBatchReader, Table, Field, or Schema.
-
column(str | None, default:None) –The name of the geometry column to retrieve, if there's more than one. For Schema, Table, and RecordBatchReader inputs, there may be more than one geometry column included. If there are multiple geometry columns, you must pass this
columnparameter. If there is only one geometry column, it will be inferred. Defaults to None.
Raises:
-
ValueError–If no geometry column could be found.
Returns:
-
CRS | None–a pyproj CRS object.
geoarrow.rust.core.get_type_id ¶
get_type_id(input: ArrowArrayExportable) -> Array
get_type_id(input: ArrowStreamExportable) -> ArrayReader
get_type_id(
input: ArrowArrayExportable | ArrowStreamExportable,
) -> Array | ArrayReader
Returns integer type ids for each geometry in the input.
The returned integers match the internal ids of the GeoArrow Geometry type:
| Type ID | Geometry type |
|---|---|
| 1 | Point |
| 2 | LineString |
| 3 | Polygon |
| 4 | MultiPoint |
| 5 | MultiLineString |
| 6 | MultiPolygon |
| 7 | GeometryCollection |
| 11 | Point Z |
| 12 | LineString Z |
| 13 | Polygon Z |
| 14 | MultiPoint Z |
| 15 | MultiLineString Z |
| 16 | MultiPolygon Z |
| 17 | GeometryCollection Z |
| 21 | Point M |
| 22 | LineString M |
| 23 | Polygon M |
| 24 | MultiPoint M |
| 25 | MultiLineString M |
| 26 | MultiPolygon M |
| 27 | GeometryCollection M |
| 31 | Point ZM |
| 32 | LineString ZM |
| 33 | Polygon ZM |
| 34 | MultiPoint ZM |
| 35 | MultiLineString ZM |
| 36 | MultiPolygon ZM |
| 37 | GeometryCollection ZM |
Warning
These ids do not exactly match the result of shapely.get_type_id. Shapely does
not distinguish between dimensions. Also the ids differ for Point and
LineString compared to here.
Parameters:
-
input(ArrowArrayExportable | ArrowStreamExportable) –Input geometry array, chunked array, or stream.
Returns:
-
Array | ArrayReader–An int8 Array of type ids.