pub trait GeometryArrayTrait: Debug + Send + Sync {
Show 18 methods // Required methods fn as_any(&self) -> &dyn Any; fn data_type(&self) -> &GeoDataType; fn storage_type(&self) -> DataType; fn extension_field(&self) -> Arc<Field>; fn extension_name(&self) -> &str; fn into_array_ref(self) -> ArrayRef; fn to_array_ref(&self) -> ArrayRef; fn coord_type(&self) -> CoordType; fn len(&self) -> usize; fn validity(&self) -> Option<&NullBuffer>; fn metadata(&self) -> Arc<ArrayMetadata>; fn as_ref(&self) -> &dyn GeometryArrayTrait; // Provided methods fn is_empty(&self) -> bool { ... } fn nulls(&self) -> Option<&NullBuffer> { ... } fn logical_nulls(&self) -> Option<NullBuffer> { ... } fn null_count(&self) -> usize { ... } fn is_null(&self, i: usize) -> bool { ... } fn is_valid(&self, i: usize) -> bool { ... }
}
Expand description

A trait of common methods that all geometry arrays in this crate implement.

This trait is often used for downcasting. If you have a dynamically-typed Arc<dyn GeometryArrayTrait>, to downcast into a strongly-typed chunked array use as_any with the data_type method to discern which chunked array type to pass to downcast_ref.

Required Methods§

source

fn as_any(&self) -> &dyn Any

Returns the array as Any so that it can be downcasted to a specific implementation.

Example:
//use geoarrow::datatypes::GeoDataType;
//use geoarrow::array::PointArray;
//use geoarrow::GeometryArrayTrait;
//use geo::point;

//let point = point!(x: 1., y: 2.);
//let point_array: PointArray = vec![point].into();

//let geometry_array = Arc::new(point_array) as Arc<dyn GeometryArrayTrait>;


let id = Int32Array::from(vec![1, 2, 3, 4, 5]);
let batch = RecordBatch::try_new(
    Arc::new(Schema::new(vec![Field::new("id", DataType::Int32, false)])),
    vec![Arc::new(id)]
).unwrap();

let int32array = batch
    .column(0)
    .as_any()
    .downcast_ref::<Int32Array>()
    .expect("Failed to downcast");
source

fn data_type(&self) -> &GeoDataType

Returns a reference to the GeoDataType of this array.

Example:
use geoarrow::datatypes::GeoDataType;
use geoarrow::array::PointArray;
use geoarrow::GeometryArrayTrait;
use geo::point;

let point = point!(x: 1., y: 2.);
let point_array: PointArray = vec![point].as_slice().into();

assert!(matches!(point_array.data_type(), GeoDataType::Point(_)));
source

fn storage_type(&self) -> DataType

Get the logical DataType of this array.

source

fn extension_field(&self) -> Arc<Field>

Get the extension type of this array, as defined by the GeoArrow specification.

Always returns DataType::Extension.

source

fn extension_name(&self) -> &str

Get the extension name of this array.

source

fn into_array_ref(self) -> ArrayRef

Convert this array into an arced arrow array.

Implementation

This is O(1).

source

fn to_array_ref(&self) -> ArrayRef

source

fn coord_type(&self) -> CoordType

Get the coordinate type of this geometry array, either interleaved or separated.

source

fn len(&self) -> usize

The number of geometries contained in this array.

source

fn validity(&self) -> Option<&NullBuffer>

Access the array’s validity. Every array has an optional NullBuffer that, when available specifies whether the array slot is valid or not (null). When the validity is None, all slots are valid.

source

fn metadata(&self) -> Arc<ArrayMetadata>

source

fn as_ref(&self) -> &dyn GeometryArrayTrait

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if the array is empty.

source

fn nulls(&self) -> Option<&NullBuffer>

source

fn logical_nulls(&self) -> Option<NullBuffer>

source

fn null_count(&self) -> usize

The number of null slots in this array.

Implementation

This is O(1) since the number of null elements is pre-computed.

source

fn is_null(&self, i: usize) -> bool

Returns whether slot i is null.

Panic

Panics iff i >= self.len().

source

fn is_valid(&self, i: usize) -> bool

Returns whether slot i is valid.

Panic

Panics iff i >= self.len().

Trait Implementations§

source§

impl AffineOps<&[AffineTransform]> for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn affine_transform(&self, transform: &[AffineTransform]) -> Self::Output

Apply transform immutably, outputting a new geometry.
source§

impl AffineOps<&AffineTransform> for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn affine_transform(&self, transform: &AffineTransform) -> Self::Output

Apply transform immutably, outputting a new geometry.
source§

impl Area for &dyn GeometryArrayTrait

source§

impl Area for &dyn GeometryArrayTrait

source§

impl AsGeometryArray for &dyn GeometryArrayTrait

source§

fn as_point_opt(&self) -> Option<&PointArray>

Downcast this to a PointArray returning None if not possible
source§

fn as_line_string_opt(&self) -> Option<&LineStringArray<i32>>

Downcast this to a LineStringArray with i32 offsets returning None if not possible
source§

fn as_large_line_string_opt(&self) -> Option<&LineStringArray<i64>>

Downcast this to a LineStringArray with i64 offsets returning None if not possible
source§

fn as_polygon_opt(&self) -> Option<&PolygonArray<i32>>

Downcast this to a PolygonArray with i32 offsets returning None if not possible
source§

fn as_large_polygon_opt(&self) -> Option<&PolygonArray<i64>>

Downcast this to a PolygonArray with i64 offsets returning None if not possible
source§

fn as_multi_point_opt(&self) -> Option<&MultiPointArray<i32>>

Downcast this to a MultiPointArray with i32 offsets returning None if not possible
source§

fn as_large_multi_point_opt(&self) -> Option<&MultiPointArray<i64>>

Downcast this to a MultiPointArray with i64 offsets returning None if not possible
source§

fn as_multi_line_string_opt(&self) -> Option<&MultiLineStringArray<i32>>

Downcast this to a MultiLineStringArray with i32 offsets returning None if not possible
source§

fn as_large_multi_line_string_opt(&self) -> Option<&MultiLineStringArray<i64>>

Downcast this to a MultiLineStringArray with i64 offsets returning None if not possible
source§

fn as_multi_polygon_opt(&self) -> Option<&MultiPolygonArray<i32>>

Downcast this to a MultiPolygonArray with i32 offsets returning None if not possible
source§

fn as_large_multi_polygon_opt(&self) -> Option<&MultiPolygonArray<i64>>

Downcast this to a MultiPolygonArray with i64 offsets returning None if not possible
source§

fn as_mixed_opt(&self) -> Option<&MixedGeometryArray<i32>>

Downcast this to a MixedGeometryArray with i32 offsets returning None if not possible
source§

fn as_large_mixed_opt(&self) -> Option<&MixedGeometryArray<i64>>

Downcast this to a MixedGeometryArray with i64 offsets returning None if not possible
source§

fn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray<i32>>

Downcast this to a GeometryCollectionArray with i32 offsets returning None if not possible
source§

fn as_large_geometry_collection_opt( &self ) -> Option<&GeometryCollectionArray<i64>>

Downcast this to a GeometryCollectionArray with i64 offsets returning None if not possible
source§

fn as_wkb_opt(&self) -> Option<&WKBArray<i32>>

Downcast this to a WKBArray with i32 offsets returning None if not possible
source§

fn as_large_wkb_opt(&self) -> Option<&WKBArray<i64>>

Downcast this to a WKBArray with i64 offsets returning None if not possible
source§

fn as_rect_opt(&self) -> Option<&RectArray>

Downcast this to a RectArray returning None if not possible
source§

fn as_point(&self) -> &PointArray

Downcast this to a PointArray panicking if not possible
source§

fn as_line_string(&self) -> &LineStringArray<i32>

Downcast this to a LineStringArray with i32 offsets panicking if not possible
source§

fn as_large_line_string(&self) -> &LineStringArray<i64>

Downcast this to a LineStringArray with i64 offsets panicking if not possible
source§

fn as_polygon(&self) -> &PolygonArray<i32>

Downcast this to a PolygonArray with i32 offsets panicking if not possible
source§

fn as_large_polygon(&self) -> &PolygonArray<i64>

Downcast this to a PolygonArray with i64 offsets panicking if not possible
source§

fn as_multi_point(&self) -> &MultiPointArray<i32>

Downcast this to a MultiPointArray with i32 offsets panicking if not possible
source§

fn as_large_multi_point(&self) -> &MultiPointArray<i64>

Downcast this to a MultiPointArray with i64 offsets panicking if not possible
source§

fn as_multi_line_string(&self) -> &MultiLineStringArray<i32>

Downcast this to a MultiLineStringArray with i32 offsets panicking if not possible
source§

fn as_large_multi_line_string(&self) -> &MultiLineStringArray<i64>

Downcast this to a MultiLineStringArray with i64 offsets panicking if not possible
source§

fn as_multi_polygon(&self) -> &MultiPolygonArray<i32>

Downcast this to a MultiPolygonArray with i32 offsets panicking if not possible
source§

fn as_large_multi_polygon(&self) -> &MultiPolygonArray<i64>

Downcast this to a MultiPolygonArray with i64 offsets panicking if not possible
source§

fn as_mixed(&self) -> &MixedGeometryArray<i32>

Downcast this to a MixedGeometryArray with i32 offsets panicking if not possible
source§

fn as_large_mixed(&self) -> &MixedGeometryArray<i64>

Downcast this to a MixedGeometryArray with i64 offsets panicking if not possible
source§

fn as_geometry_collection(&self) -> &GeometryCollectionArray<i32>

Downcast this to a GeometryCollectionArray with i32 offsets panicking if not possible
source§

fn as_large_geometry_collection(&self) -> &GeometryCollectionArray<i64>

Downcast this to a GeometryCollectionArray with i64 offsets panicking if not possible
source§

fn as_wkb(&self) -> &WKBArray<i32>

Downcast this to a WKBArray with i32 offsets panicking if not possible
source§

fn as_large_wkb(&self) -> &WKBArray<i64>

Downcast this to a WKBArray with i64 offsets panicking if not possible
source§

fn as_rect(&self) -> &RectArray

Downcast this to a RectArray panicking if not possible
source§

impl BoundingRect for &dyn GeometryArrayTrait

§

type Output = Result<RectArray, GeoArrowError>

source§

fn bounding_rect(&self) -> Self::Output

Return the bounding rectangle of a geometry Read more
source§

impl Cast for &dyn GeometryArrayTrait

source§

impl Center for &dyn GeometryArrayTrait

source§

impl Centroid for &dyn GeometryArrayTrait

source§

impl ChaikinSmoothing for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn chaikin_smoothing(&self, n_iterations: u32) -> Self::Output

create a new geometry with the Chaikin smoothing being applied n_iterations times.
source§

impl ChamberlainDuquetteArea for &dyn GeometryArrayTrait

source§

impl<O: OffsetSizeTrait> ConvexHull<O> for &dyn GeometryArrayTrait

source§

impl Densify for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn densify(&self, max_distance: f64) -> Self::Output

source§

impl Downcast for &dyn GeometryArrayTrait

§

type Output = Arc<dyn GeometryArrayTrait>

source§

fn downcasted_data_type(&self, small_offsets: bool) -> GeoDataType

The data type that downcasting would result in.
source§

fn downcast(&self, small_offsets: bool) -> Self::Output

If possible, convert this array to a simpler and/or smaller data type Read more
source§

impl EuclideanLength for &dyn GeometryArrayTrait

§

type Output = Result<PrimitiveArray<Float64Type>, GeoArrowError>

source§

fn euclidean_length(&self) -> Self::Output

Calculation of the length of a Line Read more
source§

impl GeodesicArea for &dyn GeometryArrayTrait

§

type OutputSingle = Result<PrimitiveArray<Float64Type>, GeoArrowError>

§

type OutputDouble = Result<(PrimitiveArray<Float64Type>, PrimitiveArray<Float64Type>), GeoArrowError>

source§

fn geodesic_area_signed(&self) -> Self::OutputSingle

Determine the area of a geometry on an ellipsoidal model of the earth. Read more
source§

fn geodesic_area_unsigned(&self) -> Self::OutputSingle

Determine the area of a geometry on an ellipsoidal model of the earth. Supports very large geometries that cover a significant portion of the earth. Read more
source§

fn geodesic_perimeter(&self) -> Self::OutputSingle

Determine the perimeter of a geometry on an ellipsoidal model of the earth. Read more
source§

fn geodesic_perimeter_area_signed(&self) -> Self::OutputDouble

Determine the perimeter and area of a geometry on an ellipsoidal model of the earth, all in one operation. Read more
source§

fn geodesic_perimeter_area_unsigned(&self) -> Self::OutputDouble

Determine the perimeter and area of a geometry on an ellipsoidal model of the earth, all in one operation. Supports very large geometries that cover a significant portion of the earth. Read more
source§

impl GeodesicLength for &dyn GeometryArrayTrait

§

type Output = Result<PrimitiveArray<Float64Type>, GeoArrowError>

source§

fn geodesic_length(&self) -> Self::Output

Determine the length of a geometry on an ellipsoidal model of the earth. Read more
source§

impl HasDimensions for &dyn GeometryArrayTrait

§

type Output = Result<BooleanArray, GeoArrowError>

source§

fn is_empty(&self) -> Self::Output

Some geometries, like a MultiPoint, can have zero coordinates - we call these empty. Read more
source§

impl HaversineLength for &dyn GeometryArrayTrait

§

type Output = Result<PrimitiveArray<Float64Type>, GeoArrowError>

source§

fn haversine_length(&self) -> Self::Output

Determine the length of a geometry using the haversine formula. Read more
source§

impl IsRing for &dyn GeometryArrayTrait

source§

impl IsValid for &dyn GeometryArrayTrait

source§

impl<O: OffsetSizeTrait> MinimumRotatedRect<O> for &dyn GeometryArrayTrait

source§

impl RemoveRepeatedPoints for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn remove_repeated_points(&self) -> Self::Output

Create a new geometry with (consecutive) repeated points removed.
source§

impl Simplify for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn simplify(&self, epsilon: &f64) -> Self::Output

Returns the simplified representation of a geometry, using the Ramer–Douglas–Peucker algorithm Read more
source§

impl SimplifyVw for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn simplify_vw(&self, epsilon: &f64) -> Self::Output

Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm Read more
source§

impl Take for &dyn GeometryArrayTrait

§

type Output = Result<Arc<dyn GeometryArrayTrait>, GeoArrowError>

source§

fn take(&self, indices: &UInt32Array) -> Self::Output

source§

fn take_range(&self, range: &Range<usize>) -> Self::Output

source§

impl VincentyLength for &dyn GeometryArrayTrait

§

type Output = Result<PrimitiveArray<Float64Type>, GeoArrowError>

source§

fn vincenty_length(&self) -> Self::Output

Determine the length of a geometry using Vincenty’s formulae. Read more

Implementors§