Array¶
geoarrow.rust.core.GeoArray ¶
__arrow_c_array__ ¶
An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.
For example, you can call pyarrow.array() to convert this
array into a pyarrow array, without copying memory.
__init__ ¶
__init__(data: ArrowArrayExportable) -> None
Create a new GeoArray.
At the moment this is solely an alias for from_arrow().
cast ¶
Cast to another GeoType.
Criteria:¶
- Dimension must be compatible:
- If the source array and destination type are both dimension-aware, then their dimensions must match.
- Casts from dimension-aware to dimensionless arrays (
GeometryArray,WkbArray,WkbViewArray,WktArray,WktViewArray) are always allowed.
- GeoArrow metadata (i.e. CRS and edges) on the source and destination types must match.
Infallible casts:¶
As long as the above criteria are met, these casts will always succeed without erroring.
- The same geometry type with different coord types.
- Any source array type to
Geometry,Wkb,LargeWkb,WkbView,Wkt,LargeWkt, orWktView. PointtoMultiPointLineStringtoMultiLineStringPolygontoMultiPolygon
Fallible casts:¶
Geometryto any other native type.- Parsing
WKBorWKTto any native type other thanGeometry. MultiPointtoPointMultiLineStringtoLineStringMultiPolygontoPolygon
downcast ¶
downcast(*, coord_type: CoordTypeInput = SEPARATED) -> GeoArray
Downcast to its simplest, most-compact native geometry representation.
If there is no simpler representation, the array is returned unchanged.
from_arrow
classmethod
¶
from_arrow(data: ArrowArrayExportable) -> GeoArray
Import an array from an Arrow array object.
This uses the Arrow PyCapsule interface to import the array, so any producer that implements the protocol is supported.
The existing array must have associated GeoArrow metadata.