Skip to content

Commit

Permalink
Rename UnknownGeometryArray to GeometryArray (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Dec 4, 2024
1 parent 4784774 commit 432b81b
Show file tree
Hide file tree
Showing 33 changed files with 1,223 additions and 1,699 deletions.
2 changes: 1 addition & 1 deletion python/geoarrow-core/src/interop/shapely/to_shapely.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn pyarray_to_shapely(py: Python, input: PyArray) -> PyGeoArrowResult<Bound<PyAn
Rect(_) => rect_arr(py, array.as_ref().as_rect().clone()),
Mixed(_, _) => via_wkb(py, array),
GeometryCollection(_, _) => via_wkb(py, array),
Unknown(_) => via_wkb(py, array),
Geometry(_) => via_wkb(py, array),
}
}
AnyType::Serialized(typ) => {
Expand Down
6 changes: 3 additions & 3 deletions rust/geoarrow/src/algorithm/geo_index/rtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl_rtree!(MultiPolygonArray, bounding_rect_multipolygon);
impl_rtree!(MixedGeometryArray, bounding_rect_geometry);
impl_rtree!(GeometryCollectionArray, bounding_rect_geometry_collection);
impl_rtree!(RectArray, bounding_rect_rect);
impl_rtree!(UnknownGeometryArray, bounding_rect_geometry);
impl_rtree!(GeometryArray, bounding_rect_geometry);

impl RTree for &dyn NativeArray {
type Output = OwnedRTree<f64>;
Expand All @@ -75,7 +75,7 @@ impl RTree for &dyn NativeArray {
Mixed(_, _) => impl_method!(as_mixed),
GeometryCollection(_, _) => impl_method!(as_geometry_collection),
Rect(_) => impl_method!(as_rect),
Unknown(_) => impl_method!(as_unknown),
Geometry(_) => impl_method!(as_geometry),
}
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@ impl RTree for &dyn ChunkedNativeArray {
Mixed(_, _) => impl_method!(as_mixed),
GeometryCollection(_, _) => impl_method!(as_geometry_collection),
Rect(_) => impl_method!(as_rect),
Unknown(_) => todo!("Chunked unknown array"), // impl_method!(as_unknown),
Geometry(_) => todo!("Chunked unknown array"), // impl_method!(as_unknown),
};
Ok(result)
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/geos/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl Area for &dyn NativeArray {
type Output = Result<Float64Array>;
Expand All @@ -69,7 +69,7 @@ impl Area for &dyn NativeArray {
Mixed(_, _) => self.as_mixed().area(),
GeometryCollection(_, _) => self.as_geometry_collection().area(),
Rect(_) => self.as_rect().area(),
Unknown(_) => self.as_unknown().area(),
Geometry(_) => self.as_geometry().area(),
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions rust/geoarrow/src/algorithm/geos/is_empty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::algorithm::native::Unary;
use crate::array::unknown::UnknownGeometryArray;
use crate::array::*;
use crate::chunked_array::{ChunkedArray, ChunkedGeometryArray};
use crate::datatypes::NativeType;
Expand Down Expand Up @@ -37,7 +36,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl IsEmpty for &dyn NativeArray {
type Output = Result<BooleanArray>;
Expand All @@ -55,7 +54,7 @@ impl IsEmpty for &dyn NativeArray {
Mixed(_, _) => IsEmpty::is_empty(self.as_mixed()),
GeometryCollection(_, _) => IsEmpty::is_empty(self.as_geometry_collection()),
Rect(_) => IsEmpty::is_empty(self.as_rect()),
Unknown(_) => IsEmpty::is_empty(self.as_unknown()),
Geometry(_) => IsEmpty::is_empty(self.as_geometry()),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/geos/is_ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl IsRing for &dyn NativeArray {
type Output = Result<BooleanArray>;
Expand All @@ -54,7 +54,7 @@ impl IsRing for &dyn NativeArray {
Mixed(_, _) => self.as_mixed().is_ring(),
GeometryCollection(_, _) => self.as_geometry_collection().is_ring(),
Rect(_) => self.as_rect().is_ring(),
Unknown(_) => self.as_unknown().is_ring(),
Geometry(_) => self.as_geometry().is_ring(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/geos/is_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl IsSimple for &dyn NativeArray {
type Output = Result<BooleanArray>;
Expand All @@ -54,7 +54,7 @@ impl IsSimple for &dyn NativeArray {
Mixed(_, _) => self.as_mixed().is_simple(),
GeometryCollection(_, _) => self.as_geometry_collection().is_simple(),
Rect(_) => self.as_rect().is_simple(),
Unknown(_) => self.as_unknown().is_simple(),
Geometry(_) => self.as_geometry().is_simple(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/geos/is_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl IsValid for &dyn NativeArray {
type Output = Result<BooleanArray>;
Expand All @@ -55,7 +55,7 @@ impl IsValid for &dyn NativeArray {
Mixed(_, _) => IsValid::is_valid(self.as_mixed()),
GeometryCollection(_, _) => IsValid::is_valid(self.as_geometry_collection()),
Rect(_) => IsValid::is_valid(self.as_rect()),
Unknown(_) => IsValid::is_valid(self.as_unknown()),
Geometry(_) => IsValid::is_valid(self.as_geometry()),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/geos/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ iter_geos_impl!(MultiPolygonArray);
iter_geos_impl!(MixedGeometryArray);
iter_geos_impl!(GeometryCollectionArray);
iter_geos_impl!(RectArray);
iter_geos_impl!(UnknownGeometryArray);
iter_geos_impl!(GeometryArray);

impl Length for &dyn NativeArray {
type Output = Result<Float64Array>;
Expand All @@ -62,7 +62,7 @@ impl Length for &dyn NativeArray {
Mixed(_, _) => self.as_mixed().length(),
GeometryCollection(_, _) => self.as_geometry_collection().length(),
Rect(_) => self.as_rect().length(),
Unknown(_) => self.as_unknown().length(),
Geometry(_) => self.as_geometry().length(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/geoarrow/src/algorithm/native/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ macro_rules! impl_chunked_cast_non_generic {
Mixed(_, _) => impl_cast!(as_mixed),
GeometryCollection(_, _) => impl_cast!(as_geometry_collection),
Rect(_) => impl_cast!(as_rect),
Unknown(_) => todo!("cast to unknown"),
Geometry(_) => todo!("cast to unknown"),
};
Ok(result)
}
Expand Down Expand Up @@ -314,7 +314,7 @@ macro_rules! impl_chunked_cast_generic {
Mixed(_, _) => impl_cast!(as_mixed),
GeometryCollection(_, _) => impl_cast!(as_geometry_collection),
Rect(_) => impl_cast!(as_rect),
Unknown(_) => todo!("cast to unknown"),
Geometry(_) => todo!("cast to unknown"),
};
Ok(result)
}
Expand Down
6 changes: 3 additions & 3 deletions rust/geoarrow/src/algorithm/native/total_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl_array!(MultiLineStringArray, add_multi_line_string);
impl_array!(MultiPolygonArray, add_multi_polygon);
impl_array!(MixedGeometryArray, add_geometry);
impl_array!(GeometryCollectionArray, add_geometry_collection);
impl_array!(UnknownGeometryArray, add_geometry);
impl_array!(GeometryArray, add_geometry);

// impl<O: OffsetSizeTrait> TotalBounds for WKBArray<O> {
// fn total_bounds(&self) -> BoundingRect {
Expand All @@ -77,7 +77,7 @@ impl TotalBounds for &dyn NativeArray {
Mixed(_, _) => self.as_mixed().total_bounds(),
GeometryCollection(_, _) => self.as_geometry_collection().total_bounds(),
Rect(_) => self.as_rect().total_bounds(),
Unknown(_) => self.as_unknown().total_bounds(),
Geometry(_) => self.as_geometry().total_bounds(),
// WKB => self.as_wkb().total_bounds(),
// LargeWKB => self.as_large_wkb().total_bounds(),
}
Expand Down Expand Up @@ -107,7 +107,7 @@ impl TotalBounds for &dyn ChunkedNativeArray {
Mixed(_, _) => self.as_mixed().total_bounds(),
GeometryCollection(_, _) => self.as_geometry_collection().total_bounds(),
Rect(_) => self.as_rect().total_bounds(),
Unknown(_) => self.as_unknown().total_bounds(),
Geometry(_) => self.as_geometry().total_bounds(),
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions rust/geoarrow/src/algorithm/native/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use arrow_array::types::ArrowPrimitiveType;
use arrow_array::{BooleanArray, OffsetSizeTrait, PrimitiveArray};
use arrow_buffer::{BooleanBufferBuilder, BufferBuilder};

use crate::array::unknown::UnknownGeometryArray;
use crate::array::*;
use crate::datatypes::Dimension;
use crate::trait_::ArrayAccessor;
Expand Down Expand Up @@ -97,7 +96,7 @@ impl Unary<'_> for MultiPolygonArray {}
impl Unary<'_> for MixedGeometryArray {}
impl Unary<'_> for GeometryCollectionArray {}
impl Unary<'_> for RectArray {}
impl Unary<'_> for UnknownGeometryArray {}
impl Unary<'_> for GeometryArray {}
impl<O: OffsetSizeTrait> Unary<'_> for WKBArray<O> {}

#[allow(dead_code)]
Expand Down Expand Up @@ -157,4 +156,4 @@ impl UnaryPoint<'_> for MultiPolygonArray {}
impl UnaryPoint<'_> for MixedGeometryArray {}
impl UnaryPoint<'_> for GeometryCollectionArray {}
impl UnaryPoint<'_> for RectArray {}
impl UnaryPoint<'_> for UnknownGeometryArray {}
impl UnaryPoint<'_> for GeometryArray {}
23 changes: 11 additions & 12 deletions rust/geoarrow/src/array/cast.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::array::unknown::UnknownGeometryArray;
use crate::array::*;
use crate::chunked_array::*;

Expand Down Expand Up @@ -89,13 +88,13 @@ pub trait AsNativeArray {
self.as_rect_opt().unwrap()
}

/// Downcast this to a [`UnknownGeometryArray`] returning `None` if not possible
fn as_unknown_opt(&self) -> Option<&UnknownGeometryArray>;
/// Downcast this to a [`GeometryArray`] returning `None` if not possible
fn as_geometry_opt(&self) -> Option<&GeometryArray>;

/// Downcast this to a [`UnknownGeometryArray`] panicking if not possible
/// Downcast this to a [`GeometryArray`] panicking if not possible
#[inline]
fn as_unknown(&self) -> &UnknownGeometryArray {
self.as_unknown_opt().unwrap()
fn as_geometry(&self) -> &GeometryArray {
self.as_geometry_opt().unwrap()
}
}

Expand Down Expand Up @@ -146,8 +145,8 @@ impl AsNativeArray for &dyn NativeArray {
}

#[inline]
fn as_unknown_opt(&self) -> Option<&UnknownGeometryArray> {
self.as_any().downcast_ref::<UnknownGeometryArray>()
fn as_geometry_opt(&self) -> Option<&GeometryArray> {
self.as_any().downcast_ref::<GeometryArray>()
}
}

Expand Down Expand Up @@ -271,12 +270,12 @@ pub trait AsChunkedNativeArray {
}

/// Downcast this to a [`ChunkedUnknownGeometryArray`] returning `None` if not possible
fn as_unknown_opt(&self) -> Option<&ChunkedUnknownGeometryArray>;
fn as_geometry_opt(&self) -> Option<&ChunkedUnknownGeometryArray>;

/// Downcast this to a [`ChunkedUnknownGeometryArray`] panicking if not possible
#[inline]
fn as_unknown(&self) -> &ChunkedUnknownGeometryArray {
self.as_unknown_opt().unwrap()
fn as_geometry(&self) -> &ChunkedUnknownGeometryArray {
self.as_geometry_opt().unwrap()
}
}

Expand Down Expand Up @@ -328,7 +327,7 @@ impl AsChunkedNativeArray for &dyn ChunkedNativeArray {
}

#[inline]
fn as_unknown_opt(&self) -> Option<&ChunkedUnknownGeometryArray> {
fn as_geometry_opt(&self) -> Option<&ChunkedUnknownGeometryArray> {
self.as_any().downcast_ref::<ChunkedUnknownGeometryArray>()
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/geoarrow/src/array/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl NativeArrayDyn {
Arc::new(GeometryCollectionArray::try_from((array, field))?)
}
Rect(_) => Arc::new(RectArray::try_from((array, field))?),
Unknown(_) => Arc::new(UnknownGeometryArray::try_from((array, field))?),
Geometry(_) => Arc::new(GeometryArray::try_from((array, field))?),
};

Ok(Self(geo_arr))
Expand Down
Loading

0 comments on commit 432b81b

Please sign in to comment.