pub trait AsGeoArrowArray {
Show 26 methods
// Required methods
fn as_point_opt(&self) -> Option<&PointArray>;
fn as_line_string_opt(&self) -> Option<&LineStringArray>;
fn as_polygon_opt(&self) -> Option<&PolygonArray>;
fn as_multi_point_opt(&self) -> Option<&MultiPointArray>;
fn as_multi_line_string_opt(&self) -> Option<&MultiLineStringArray>;
fn as_multi_polygon_opt(&self) -> Option<&MultiPolygonArray>;
fn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray>;
fn as_rect_opt(&self) -> Option<&RectArray>;
fn as_geometry_opt(&self) -> Option<&GeometryArray>;
fn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWkbArray<O>>;
fn as_wkb_view_opt(&self) -> Option<&WkbViewArray>;
fn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWktArray<O>>;
fn as_wkt_view_opt(&self) -> Option<&WktViewArray>;
// Provided methods
fn as_point(&self) -> &PointArray { ... }
fn as_line_string(&self) -> &LineStringArray { ... }
fn as_polygon(&self) -> &PolygonArray { ... }
fn as_multi_point(&self) -> &MultiPointArray { ... }
fn as_multi_line_string(&self) -> &MultiLineStringArray { ... }
fn as_multi_polygon(&self) -> &MultiPolygonArray { ... }
fn as_geometry_collection(&self) -> &GeometryCollectionArray { ... }
fn as_rect(&self) -> &RectArray { ... }
fn as_geometry(&self) -> &GeometryArray { ... }
fn as_wkb<O: OffsetSizeTrait>(&self) -> &GenericWkbArray<O> { ... }
fn as_wkb_view(&self) -> &WkbViewArray { ... }
fn as_wkt<O: OffsetSizeTrait>(&self) -> &GenericWktArray<O> { ... }
fn as_wkt_view(&self) -> &WktViewArray { ... }
}
Expand description
Helpers for downcasting a GeoArrowArray
to a concrete implementation.
use std::sync::Arc;
use arrow_array::{Int32Array, RecordBatch};
use arrow_schema::{Schema, Field, DataType, ArrowError};
use geo_types::point;
use geoarrow_array::array::PointArray;
use geoarrow_array::builder::PointBuilder;
use geoarrow_array::cast::AsGeoArrowArray;
use geoarrow_array::GeoArrowArray;
use geo_traits::CoordTrait;
use geoarrow_schema::{Dimension, PointType};
let point1 = point!(x: 1., y: 2.);
let point2 = point!(x: 3., y: 4.);
let point3 = point!(x: 5., y: 6.);
let geoms = [point1, point2, point3];
let geom_type = PointType::new(Dimension::XY, Default::default());
let point_array = PointBuilder::from_points(geoms.iter(), geom_type).finish();
let generic_array: Arc<dyn GeoArrowArray> = Arc::new(point_array.clone());
let point_array2 = generic_array.as_point();
assert_eq!(&point_array, point_array2);
Required Methods§
Sourcefn as_point_opt(&self) -> Option<&PointArray>
fn as_point_opt(&self) -> Option<&PointArray>
Downcast this to a PointArray
returning None
if not possible
Sourcefn as_line_string_opt(&self) -> Option<&LineStringArray>
fn as_line_string_opt(&self) -> Option<&LineStringArray>
Downcast this to a LineStringArray
with i32
offsets returning None
if not possible
Sourcefn as_polygon_opt(&self) -> Option<&PolygonArray>
fn as_polygon_opt(&self) -> Option<&PolygonArray>
Downcast this to a PolygonArray
with i32
offsets returning None
if not possible
Sourcefn as_multi_point_opt(&self) -> Option<&MultiPointArray>
fn as_multi_point_opt(&self) -> Option<&MultiPointArray>
Downcast this to a MultiPointArray
with i32
offsets returning None
if not possible
Sourcefn as_multi_line_string_opt(&self) -> Option<&MultiLineStringArray>
fn as_multi_line_string_opt(&self) -> Option<&MultiLineStringArray>
Downcast this to a MultiLineStringArray
with i32
offsets returning None
if not
possible
Sourcefn as_multi_polygon_opt(&self) -> Option<&MultiPolygonArray>
fn as_multi_polygon_opt(&self) -> Option<&MultiPolygonArray>
Downcast this to a MultiPolygonArray
with i32
offsets returning None
if not
possible
Sourcefn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray>
fn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray>
Downcast this to a GeometryCollectionArray
with i32
offsets returning None
if not
possible
Sourcefn as_rect_opt(&self) -> Option<&RectArray>
fn as_rect_opt(&self) -> Option<&RectArray>
Downcast this to a RectArray
returning None
if not possible
Sourcefn as_geometry_opt(&self) -> Option<&GeometryArray>
fn as_geometry_opt(&self) -> Option<&GeometryArray>
Downcast this to a GeometryArray
returning None
if not possible
Sourcefn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWkbArray<O>>
fn as_wkb_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWkbArray<O>>
Downcast this to a GenericWkbArray
with O
offsets returning None
if not possible
Sourcefn as_wkb_view_opt(&self) -> Option<&WkbViewArray>
fn as_wkb_view_opt(&self) -> Option<&WkbViewArray>
Downcast this to a WkbViewArray
returning None
if not possible
Sourcefn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWktArray<O>>
fn as_wkt_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericWktArray<O>>
Downcast this to a GenericWktArray
with O
offsets returning None
if not possible
Sourcefn as_wkt_view_opt(&self) -> Option<&WktViewArray>
fn as_wkt_view_opt(&self) -> Option<&WktViewArray>
Downcast this to a WktViewArray
returning None
if not possible
Provided Methods§
Sourcefn as_point(&self) -> &PointArray
fn as_point(&self) -> &PointArray
Downcast this to a PointArray
panicking if not possible
Sourcefn as_line_string(&self) -> &LineStringArray
fn as_line_string(&self) -> &LineStringArray
Downcast this to a LineStringArray
with i32
offsets panicking if not possible
Sourcefn as_polygon(&self) -> &PolygonArray
fn as_polygon(&self) -> &PolygonArray
Downcast this to a PolygonArray
with i32
offsets panicking if not possible
Sourcefn as_multi_point(&self) -> &MultiPointArray
fn as_multi_point(&self) -> &MultiPointArray
Downcast this to a MultiPointArray
with i32
offsets panicking if not possible
Sourcefn as_multi_line_string(&self) -> &MultiLineStringArray
fn as_multi_line_string(&self) -> &MultiLineStringArray
Downcast this to a MultiLineStringArray
with i32
offsets panicking if not possible
Sourcefn as_multi_polygon(&self) -> &MultiPolygonArray
fn as_multi_polygon(&self) -> &MultiPolygonArray
Downcast this to a MultiPolygonArray
with i32
offsets panicking if not possible
Sourcefn as_geometry_collection(&self) -> &GeometryCollectionArray
fn as_geometry_collection(&self) -> &GeometryCollectionArray
Downcast this to a GeometryCollectionArray
with i32
offsets panicking if not possible
Sourcefn as_geometry(&self) -> &GeometryArray
fn as_geometry(&self) -> &GeometryArray
Downcast this to a GeometryArray
panicking if not possible
Sourcefn as_wkb<O: OffsetSizeTrait>(&self) -> &GenericWkbArray<O>
fn as_wkb<O: OffsetSizeTrait>(&self) -> &GenericWkbArray<O>
Downcast this to a GenericWkbArray
with O
offsets panicking if not possible
Sourcefn as_wkb_view(&self) -> &WkbViewArray
fn as_wkb_view(&self) -> &WkbViewArray
Downcast this to a WkbViewArray
panicking if not possible
Sourcefn as_wkt<O: OffsetSizeTrait>(&self) -> &GenericWktArray<O>
fn as_wkt<O: OffsetSizeTrait>(&self) -> &GenericWktArray<O>
Downcast this to a GenericWktArray
with O
offsets panicking if not possible
Sourcefn as_wkt_view(&self) -> &WktViewArray
fn as_wkt_view(&self) -> &WktViewArray
Downcast this to a WktViewArray
panicking if not possible
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.