diff --git a/js/Cargo.lock b/js/Cargo.lock index 2e3158a5..8695cdfa 100644 --- a/js/Cargo.lock +++ b/js/Cargo.lock @@ -686,6 +686,31 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crunchy" version = "0.2.2" @@ -869,8 +894,9 @@ dependencies = [ [[package]] name = "flatgeobuf" -version = "4.4.0" -source = "git+https://github.com/flatgeobuf/flatgeobuf?rev=f554f2768b612e131e9f55d014eaa5b911a7f1b5#f554f2768b612e131e9f55d014eaa5b911a7f1b5" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d78ca20e47a9f45703d3a811f7f24935ce2d3a3f7b947fd433489ddd8daad6" dependencies = [ "byteorder", "fallible-streaming-iterator", @@ -1014,14 +1040,15 @@ dependencies = [ [[package]] name = "geo" -version = "0.28.0" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f811f663912a69249fa620dcd2a005db7254529da2d8a0b23942e81f47084501" +checksum = "34f0e6e028c581e82e6822a68869514e94c25e7f8ea669a2d8595bdf7461ccc5" dependencies = [ "earcutr", "float_next_after", "geo-types", "geographiclib-rs", + "i_overlay", "log", "num-traits", "robust", @@ -1059,6 +1086,7 @@ checksum = "b6f47c611187777bbca61ea7aba780213f5f3441fd36294ab333e96cfa791b65" dependencies = [ "approx", "num-traits", + "rayon", "rstar", "serde", ] @@ -1087,6 +1115,7 @@ dependencies = [ "half", "indexmap", "lexical-core 0.8.5", + "num-traits", "parquet", "phf", "rstar", @@ -1096,7 +1125,7 @@ dependencies = [ "thiserror", "tokio", "wkb", - "wkt 0.11.1 (git+https://github.com/georust/wkt?rev=94c32cdbdaf9523b3d71cd4b2d5d3a033efadacb)", + "wkt 0.12.0", ] [[package]] @@ -1185,7 +1214,7 @@ dependencies = [ "scroll", "serde_json", "thiserror", - "wkt 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wkt 0.11.1", ] [[package]] @@ -1485,6 +1514,50 @@ dependencies = [ "tracing", ] +[[package]] +name = "i_float" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775f9961a8d2f879725da8aff789bb20a3ddf297473e0c90af75e69313919490" +dependencies = [ + "serde", +] + +[[package]] +name = "i_key_sort" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347c253b4748a1a28baf94c9ce133b6b166f08573157e05afe718812bc599fcd" + +[[package]] +name = "i_overlay" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06740cd31c1f963823e007d8e6edcd2db634b2856f4f613e3df01737fd852482" +dependencies = [ + "i_float", + "i_key_sort", + "i_shape", + "i_tree", + "rayon", +] + +[[package]] +name = "i_shape" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27dbe9e5238d6b9c694c08415bf00fb370b089949bd818ab01f41f8927b8774c" +dependencies = [ + "i_float", + "serde", +] + +[[package]] +name = "i_tree" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "155181bc97d770181cf9477da51218a19ee92a8e5be642e796661aee2b601139" + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -2422,6 +2495,26 @@ dependencies = [ "futures", ] +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.7" @@ -3693,8 +3786,9 @@ dependencies = [ [[package]] name = "wkb" -version = "0.1.0" -source = "git+https://github.com/kylebarron/wkb?rev=51a95fff591c7e66ea10f6effaba0d48b3b0a392#51a95fff591c7e66ea10f6effaba0d48b3b0a392" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e2c084338d6407d24c5a43208aca32128a5d62107eab5ca18314395c4aa3f0" dependencies = [ "byteorder", "geo-traits", @@ -3716,8 +3810,9 @@ dependencies = [ [[package]] name = "wkt" -version = "0.11.1" -source = "git+https://github.com/georust/wkt?rev=94c32cdbdaf9523b3d71cd4b2d5d3a033efadacb#94c32cdbdaf9523b3d71cd4b2d5d3a033efadacb" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c591649bd1c9d4e28459758bbb5fb5c0edc7a67060b52422f4761c94ffe961" dependencies = [ "geo-traits", "geo-types", diff --git a/js/src/algorithm/geo/area.rs b/js/src/algorithm/geo/area.rs index c79461a8..3176c1ba 100644 --- a/js/src/algorithm/geo/area.rs +++ b/js/src/algorithm/geo/area.rs @@ -31,7 +31,6 @@ impl_area!(PolygonData); impl_area!(MultiPointData); impl_area!(MultiLineStringData); impl_area!(MultiPolygonData); -impl_area!(MixedGeometryData); impl_area!(GeometryCollectionData); macro_rules! impl_vector { @@ -61,5 +60,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/bounding_rect.rs b/js/src/algorithm/geo/bounding_rect.rs index 64d6f138..312b93a9 100644 --- a/js/src/algorithm/geo/bounding_rect.rs +++ b/js/src/algorithm/geo/bounding_rect.rs @@ -23,7 +23,6 @@ impl_bounding_rect!(PolygonData); impl_bounding_rect!(MultiPointData); impl_bounding_rect!(MultiLineStringData); impl_bounding_rect!(MultiPolygonData); -impl_bounding_rect!(MixedGeometryData); impl_bounding_rect!(GeometryCollectionData); macro_rules! impl_vector { @@ -46,5 +45,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/center.rs b/js/src/algorithm/geo/center.rs index 376777a2..3b8c2314 100644 --- a/js/src/algorithm/geo/center.rs +++ b/js/src/algorithm/geo/center.rs @@ -26,7 +26,6 @@ impl_center!(PolygonData); impl_center!(MultiPointData); impl_center!(MultiLineStringData); impl_center!(MultiPolygonData); -impl_center!(MixedGeometryData); impl_center!(GeometryCollectionData); macro_rules! impl_chunked { @@ -52,5 +51,4 @@ impl_chunked!(PolygonVector); impl_chunked!(MultiPointVector); impl_chunked!(MultiLineStringVector); impl_chunked!(MultiPolygonVector); -impl_chunked!(MixedGeometryVector); impl_chunked!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/centroid.rs b/js/src/algorithm/geo/centroid.rs index 0e938b49..cfa4f796 100644 --- a/js/src/algorithm/geo/centroid.rs +++ b/js/src/algorithm/geo/centroid.rs @@ -30,7 +30,6 @@ impl_centroid!(PolygonData); impl_centroid!(MultiPointData); impl_centroid!(MultiLineStringData); impl_centroid!(MultiPolygonData); -impl_centroid!(MixedGeometryData); impl_centroid!(GeometryCollectionData); macro_rules! impl_chunked { @@ -60,5 +59,4 @@ impl_chunked!(PolygonVector); impl_chunked!(MultiPointVector); impl_chunked!(MultiLineStringVector); impl_chunked!(MultiPolygonVector); -impl_chunked!(MixedGeometryVector); impl_chunked!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/chamberlain_duquette_area.rs b/js/src/algorithm/geo/chamberlain_duquette_area.rs index 5bac1de3..24fe2e25 100644 --- a/js/src/algorithm/geo/chamberlain_duquette_area.rs +++ b/js/src/algorithm/geo/chamberlain_duquette_area.rs @@ -35,7 +35,6 @@ impl_alg!(PolygonData); impl_alg!(MultiPointData); impl_alg!(MultiLineStringData); impl_alg!(MultiPolygonData); -impl_alg!(MixedGeometryData); impl_alg!(GeometryCollectionData); macro_rules! impl_vector { @@ -67,5 +66,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/convex_hull.rs b/js/src/algorithm/geo/convex_hull.rs index b70b8826..b23e62c4 100644 --- a/js/src/algorithm/geo/convex_hull.rs +++ b/js/src/algorithm/geo/convex_hull.rs @@ -28,7 +28,6 @@ impl_alg!(PolygonData); impl_alg!(MultiPointData); impl_alg!(MultiLineStringData); impl_alg!(MultiPolygonData); -impl_alg!(MixedGeometryData); impl_alg!(GeometryCollectionData); macro_rules! impl_vector { @@ -57,5 +56,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/dimensions.rs b/js/src/algorithm/geo/dimensions.rs index 8959c410..8c563c91 100644 --- a/js/src/algorithm/geo/dimensions.rs +++ b/js/src/algorithm/geo/dimensions.rs @@ -29,7 +29,6 @@ impl_alg!(PolygonData); impl_alg!(MultiPointData); impl_alg!(MultiLineStringData); impl_alg!(MultiPolygonData); -impl_alg!(MixedGeometryData); impl_alg!(GeometryCollectionData); macro_rules! impl_vector { @@ -56,5 +55,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/algorithm/geo/geodesic_area.rs b/js/src/algorithm/geo/geodesic_area.rs index b79424cf..008e2ae2 100644 --- a/js/src/algorithm/geo/geodesic_area.rs +++ b/js/src/algorithm/geo/geodesic_area.rs @@ -84,7 +84,6 @@ impl_geodesic_area!(PolygonData); impl_geodesic_area!(MultiPointData); impl_geodesic_area!(MultiLineStringData); impl_geodesic_area!(MultiPolygonData); -impl_geodesic_area!(MixedGeometryData); impl_geodesic_area!(GeometryCollectionData); macro_rules! impl_vector { @@ -168,5 +167,4 @@ impl_vector!(PolygonVector); impl_vector!(MultiPointVector); impl_vector!(MultiLineStringVector); impl_vector!(MultiPolygonVector); -impl_vector!(MixedGeometryVector); impl_vector!(GeometryCollectionVector); diff --git a/js/src/data/mod.rs b/js/src/data/mod.rs index f750f1f1..af89d08d 100644 --- a/js/src/data/mod.rs +++ b/js/src/data/mod.rs @@ -73,11 +73,6 @@ impl_data! { /// in-memory representation. pub struct MultiPolygonData(pub(crate) geoarrow::array::MultiPolygonArray); } -impl_data! { - /// An immutable array of Geometry geometries in WebAssembly memory using GeoArrow's - /// in-memory representation. - pub struct MixedGeometryData(pub(crate) geoarrow::array::MixedGeometryArray); -} impl_data! { /// An immutable array of GeometryCollection geometries in WebAssembly memory using GeoArrow's /// in-memory representation. diff --git a/js/src/ffi/to_ffi/data.rs b/js/src/ffi/to_ffi/data.rs index 18b4fc0a..34e5b4fd 100644 --- a/js/src/ffi/to_ffi/data.rs +++ b/js/src/ffi/to_ffi/data.rs @@ -43,6 +43,5 @@ impl_data!(PolygonData); impl_data!(MultiPointData); impl_data!(MultiLineStringData); impl_data!(MultiPolygonData); -impl_data!(MixedGeometryData); impl_data!(GeometryCollectionData); impl_data!(RectData); diff --git a/js/src/vector/mod.rs b/js/src/vector/mod.rs index c61e81c6..17ca96f2 100644 --- a/js/src/vector/mod.rs +++ b/js/src/vector/mod.rs @@ -53,11 +53,6 @@ impl_vector! { /// GeoArrow's in-memory representation. pub struct MultiPolygonVector(pub(crate) geoarrow::chunked_array::ChunkedMultiPolygonArray); } -impl_vector! { - /// An immutable chunked array of Geometry geometries in WebAssembly memory using - /// GeoArrow's in-memory representation. - pub struct MixedGeometryVector(pub(crate) geoarrow::chunked_array::ChunkedMixedGeometryArray); -} impl_vector! { /// An immutable chunked array of GeometryCollection geometries in WebAssembly memory using /// GeoArrow's in-memory representation. diff --git a/python/geoarrow-core/src/interop/shapely/to_shapely.rs b/python/geoarrow-core/src/interop/shapely/to_shapely.rs index 9955e0d2..3fdbcf12 100644 --- a/python/geoarrow-core/src/interop/shapely/to_shapely.rs +++ b/python/geoarrow-core/src/interop/shapely/to_shapely.rs @@ -104,7 +104,6 @@ fn pyarray_to_shapely(py: Python, input: PyArray) -> PyGeoArrowResult rect_arr(py, array.as_ref().as_rect().clone()), - Mixed(_, _) => via_wkb(py, array), GeometryCollection(_, _) => via_wkb(py, array), Geometry(_) => via_wkb(py, array), } diff --git a/python/pyo3-geoarrow/src/data_type.rs b/python/pyo3-geoarrow/src/data_type.rs index 57cf75ec..d1071724 100644 --- a/python/pyo3-geoarrow/src/data_type.rs +++ b/python/pyo3-geoarrow/src/data_type.rs @@ -63,10 +63,7 @@ impl PyNativeType { coord_type.unwrap().into(), dimension.unwrap().into(), ))), - "geometry" => Ok(Self(NativeType::Mixed( - coord_type.unwrap().into(), - dimension.unwrap().into(), - ))), + "geometry" => Ok(Self(NativeType::Geometry(coord_type.unwrap().into()))), "geometrycollection" => Ok(Self(NativeType::GeometryCollection( coord_type.unwrap().into(), dimension.unwrap().into(), diff --git a/python/pyo3-geoarrow/src/ffi/from_python/scalar.rs b/python/pyo3-geoarrow/src/ffi/from_python/scalar.rs index 462c5fb7..3890aa99 100644 --- a/python/pyo3-geoarrow/src/ffi/from_python/scalar.rs +++ b/python/pyo3-geoarrow/src/ffi/from_python/scalar.rs @@ -2,7 +2,6 @@ use std::sync::Arc; use crate::array::*; use crate::scalar::*; -use geoarrow::array::MixedGeometryArray; use geoarrow::datatypes::Dimension; use geoarrow::io::geozero::ToMixedArray; use geoarrow::scalar::GeometryScalar; @@ -26,7 +25,7 @@ impl<'a> FromPyObject<'a> for PyGeometry { let reader = GeoJsonString(json_string); // TODO: we need a dynamic dimensionality reader - let arr: MixedGeometryArray = reader + let arr = reader .to_mixed_geometry_array(Dimension::XY) .map_err(|err| PyValueError::new_err(err.to_string()))?; Ok(Self( diff --git a/rust/geoarrow/src/algorithm/geo/affine_ops.rs b/rust/geoarrow/src/algorithm/geo/affine_ops.rs index cf19296b..3914e3c3 100644 --- a/rust/geoarrow/src/algorithm/geo/affine_ops.rs +++ b/rust/geoarrow/src/algorithm/geo/affine_ops.rs @@ -246,7 +246,6 @@ impl AffineOps<&AffineTransform> for &dyn NativeArray { MultiPoint(_, _) => impl_downcast!(as_multi_point), MultiLineString(_, _) => impl_downcast!(as_multi_line_string), MultiPolygon(_, _) => impl_downcast!(as_multi_polygon), - Mixed(_, _) => Arc::new(self.as_mixed().affine_transform(transform)?), GeometryCollection(_, _) => { Arc::new(self.as_geometry_collection().affine_transform(transform)?) } @@ -324,7 +323,6 @@ impl AffineOps<&AffineTransform> for &dyn ChunkedNativeArray { MultiPoint(_, _) => impl_downcast!(as_multi_point), MultiLineString(_, _) => impl_downcast!(as_multi_line_string), MultiPolygon(_, _) => impl_downcast!(as_multi_polygon), - Mixed(_, _) => Arc::new(self.as_mixed().affine_transform(transform)?), GeometryCollection(_, _) => { Arc::new(self.as_geometry_collection().affine_transform(transform)?) } @@ -494,7 +492,6 @@ impl AffineOps<&[AffineTransform]> for &dyn NativeArray { Arc::new(self.as_multi_line_string().affine_transform(transform)) } MultiPolygon(_, XY) => Arc::new(self.as_multi_polygon().affine_transform(transform)), - Mixed(_, XY) => Arc::new(self.as_mixed().affine_transform(transform)?), GeometryCollection(_, XY) => { Arc::new(self.as_geometry_collection().affine_transform(transform)?) } diff --git a/rust/geoarrow/src/algorithm/geo/area.rs b/rust/geoarrow/src/algorithm/geo/area.rs index fbc2e42c..b6842079 100644 --- a/rust/geoarrow/src/algorithm/geo/area.rs +++ b/rust/geoarrow/src/algorithm/geo/area.rs @@ -108,7 +108,6 @@ impl Area for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().signed_area(), MultiLineString(_, _) => self.as_multi_line_string().signed_area(), MultiPolygon(_, _) => self.as_multi_polygon().signed_area(), - Mixed(_, _) => self.as_mixed().signed_area(), GeometryCollection(_, _) => self.as_geometry_collection().signed_area(), Rect(_) => self.as_rect().signed_area(), Geometry(_) => self.as_geometry().signed_area(), @@ -126,7 +125,6 @@ impl Area for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().unsigned_area(), MultiLineString(_, _) => self.as_multi_line_string().unsigned_area(), MultiPolygon(_, _) => self.as_multi_polygon().unsigned_area(), - Mixed(_, _) => self.as_mixed().unsigned_area(), GeometryCollection(_, _) => self.as_geometry_collection().unsigned_area(), Rect(_) => self.as_rect().unsigned_area(), Geometry(_) => self.as_geometry().unsigned_area(), @@ -162,7 +160,6 @@ impl Area for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().signed_area(), MultiLineString(_, _) => self.as_multi_line_string().signed_area(), MultiPolygon(_, _) => self.as_multi_polygon().signed_area(), - Mixed(_, _) => self.as_mixed().signed_area(), GeometryCollection(_, _) => self.as_geometry_collection().signed_area(), Rect(_) => self.as_rect().signed_area(), Geometry(_) => self.as_geometry().unsigned_area(), @@ -179,7 +176,6 @@ impl Area for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().unsigned_area(), MultiLineString(_, _) => self.as_multi_line_string().unsigned_area(), MultiPolygon(_, _) => self.as_multi_polygon().unsigned_area(), - Mixed(_, _) => self.as_mixed().unsigned_area(), GeometryCollection(_, _) => self.as_geometry_collection().unsigned_area(), Rect(_) => self.as_rect().unsigned_area(), Geometry(_) => self.as_geometry().unsigned_area(), diff --git a/rust/geoarrow/src/algorithm/geo/bounding_rect.rs b/rust/geoarrow/src/algorithm/geo/bounding_rect.rs index c50af085..1bcbac5c 100644 --- a/rust/geoarrow/src/algorithm/geo/bounding_rect.rs +++ b/rust/geoarrow/src/algorithm/geo/bounding_rect.rs @@ -106,7 +106,6 @@ impl BoundingRect for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().bounding_rect(), MultiLineString(_, _) => self.as_multi_line_string().bounding_rect(), MultiPolygon(_, _) => self.as_multi_polygon().bounding_rect(), - Mixed(_, _) => self.as_mixed().bounding_rect(), GeometryCollection(_, _) => self.as_geometry_collection().bounding_rect(), Geometry(_) => self.as_geometry().bounding_rect(), Rect(_) => self.as_rect().bounding_rect(), @@ -137,7 +136,6 @@ impl BoundingRect for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().bounding_rect(), MultiLineString(_, _) => self.as_multi_line_string().bounding_rect(), MultiPolygon(_, _) => self.as_multi_polygon().bounding_rect(), - Mixed(_, _) => self.as_mixed().bounding_rect(), GeometryCollection(_, _) => self.as_geometry_collection().bounding_rect(), Geometry(_) => self.as_geometry().bounding_rect(), Rect(_) => self.as_rect().bounding_rect(), diff --git a/rust/geoarrow/src/algorithm/geo/center.rs b/rust/geoarrow/src/algorithm/geo/center.rs index 61a03b67..0e69b9ce 100644 --- a/rust/geoarrow/src/algorithm/geo/center.rs +++ b/rust/geoarrow/src/algorithm/geo/center.rs @@ -88,7 +88,6 @@ impl Center for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().center(), MultiLineString(_, _) => self.as_multi_line_string().center(), MultiPolygon(_, _) => self.as_multi_polygon().center(), - Mixed(_, _) => self.as_mixed().center(), GeometryCollection(_, _) => self.as_geometry_collection().center(), Rect(_) => self.as_rect().center(), Geometry(_) => self.as_geometry().center(), @@ -118,7 +117,6 @@ impl Center for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().center(), MultiLineString(_, _) => self.as_multi_line_string().center(), MultiPolygon(_, _) => self.as_multi_polygon().center(), - Mixed(_, _) => self.as_mixed().center(), GeometryCollection(_, _) => self.as_geometry_collection().center(), Rect(_) => self.as_rect().center(), Geometry(_) => self.as_geometry().center(), diff --git a/rust/geoarrow/src/algorithm/geo/centroid.rs b/rust/geoarrow/src/algorithm/geo/centroid.rs index fdb77e59..7498ab5d 100644 --- a/rust/geoarrow/src/algorithm/geo/centroid.rs +++ b/rust/geoarrow/src/algorithm/geo/centroid.rs @@ -134,7 +134,6 @@ impl Centroid for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().centroid(), MultiLineString(_, _) => self.as_multi_line_string().centroid(), MultiPolygon(_, _) => self.as_multi_polygon().centroid(), - Mixed(_, _) => self.as_mixed().centroid(), GeometryCollection(_, _) => self.as_geometry_collection().centroid(), Rect(_) => self.as_rect().centroid(), Geometry(_) => self.as_geometry().centroid(), @@ -164,7 +163,6 @@ impl Centroid for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().centroid(), MultiLineString(_, _) => self.as_multi_line_string().centroid(), MultiPolygon(_, _) => self.as_multi_polygon().centroid(), - Mixed(_, _) => self.as_mixed().centroid(), GeometryCollection(_, _) => self.as_geometry_collection().centroid(), Rect(_) => self.as_rect().centroid(), Geometry(_) => self.as_geometry().centroid(), diff --git a/rust/geoarrow/src/algorithm/geo/chamberlain_duquette_area.rs b/rust/geoarrow/src/algorithm/geo/chamberlain_duquette_area.rs index 6ea74446..dcd41712 100644 --- a/rust/geoarrow/src/algorithm/geo/chamberlain_duquette_area.rs +++ b/rust/geoarrow/src/algorithm/geo/chamberlain_duquette_area.rs @@ -137,7 +137,6 @@ impl ChamberlainDuquetteArea for &dyn NativeArray { .as_multi_line_string() .chamberlain_duquette_signed_area(), MultiPolygon(_, _) => self.as_multi_polygon().chamberlain_duquette_signed_area(), - Mixed(_, _) => self.as_mixed().chamberlain_duquette_signed_area(), GeometryCollection(_, _) => self .as_geometry_collection() .chamberlain_duquette_signed_area(), @@ -159,7 +158,6 @@ impl ChamberlainDuquetteArea for &dyn NativeArray { .as_multi_line_string() .chamberlain_duquette_unsigned_area(), MultiPolygon(_, _) => self.as_multi_polygon().chamberlain_duquette_unsigned_area(), - Mixed(_, _) => self.as_mixed().chamberlain_duquette_unsigned_area(), GeometryCollection(_, _) => self .as_geometry_collection() .chamberlain_duquette_unsigned_area(), @@ -207,7 +205,6 @@ impl ChamberlainDuquetteArea for &dyn ChunkedNativeArray { .as_multi_line_string() .chamberlain_duquette_signed_area(), MultiPolygon(_, _) => self.as_multi_polygon().chamberlain_duquette_signed_area(), - Mixed(_, _) => self.as_mixed().chamberlain_duquette_signed_area(), GeometryCollection(_, _) => self .as_geometry_collection() .chamberlain_duquette_signed_area(), @@ -228,7 +225,6 @@ impl ChamberlainDuquetteArea for &dyn ChunkedNativeArray { .as_multi_line_string() .chamberlain_duquette_unsigned_area(), MultiPolygon(_, _) => self.as_multi_polygon().chamberlain_duquette_unsigned_area(), - Mixed(_, _) => self.as_mixed().chamberlain_duquette_unsigned_area(), GeometryCollection(_, _) => self .as_geometry_collection() .chamberlain_duquette_unsigned_area(), diff --git a/rust/geoarrow/src/algorithm/geo/contains.rs b/rust/geoarrow/src/algorithm/geo/contains.rs index 2114b738..278dd8fe 100644 --- a/rust/geoarrow/src/algorithm/geo/contains.rs +++ b/rust/geoarrow/src/algorithm/geo/contains.rs @@ -162,6 +162,8 @@ impl_contains_point!(MultiLineStringArray); impl_contains_point!(MultiPolygonArray); impl_contains_point!(MixedGeometryArray); impl_contains_point!(GeometryCollectionArray); +impl_contains_point!(GeometryArray); +impl_contains_point!(RectArray); impl> ContainsGeometry for &dyn NativeArray { fn contains(&self, rhs: &G) -> BooleanArray { @@ -174,12 +176,11 @@ impl> ContainsGeometry for &dyn NativeArray { MultiPoint(_, _) => ContainsGeometry::contains(self.as_multi_point(), rhs), MultiLineString(_, _) => ContainsGeometry::contains(self.as_multi_line_string(), rhs), MultiPolygon(_, _) => ContainsGeometry::contains(self.as_multi_polygon(), rhs), - Mixed(_, _) => ContainsGeometry::contains(self.as_mixed(), rhs), GeometryCollection(_, _) => { ContainsGeometry::contains(self.as_geometry_collection(), rhs) } - Rect(_) => ContainsGeometry::contains(self.as_mixed(), rhs), - Geometry(_) => ContainsGeometry::contains(self.as_mixed(), rhs), + Rect(_) => ContainsGeometry::contains(self.as_rect(), rhs), + Geometry(_) => ContainsGeometry::contains(self.as_geometry(), rhs), } } } diff --git a/rust/geoarrow/src/algorithm/geo/convex_hull.rs b/rust/geoarrow/src/algorithm/geo/convex_hull.rs index bf8d6788..ef9da2be 100644 --- a/rust/geoarrow/src/algorithm/geo/convex_hull.rs +++ b/rust/geoarrow/src/algorithm/geo/convex_hull.rs @@ -97,7 +97,6 @@ impl ConvexHull for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().convex_hull(), MultiLineString(_, _) => self.as_multi_line_string().convex_hull(), MultiPolygon(_, _) => self.as_multi_polygon().convex_hull(), - Mixed(_, _) => self.as_mixed().convex_hull(), GeometryCollection(_, _) => self.as_geometry_collection().convex_hull(), Rect(_) => self.as_rect().convex_hull(), Geometry(_) => self.as_geometry().convex_hull(), @@ -128,7 +127,6 @@ impl ConvexHull for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().convex_hull(), MultiLineString(_, _) => self.as_multi_line_string().convex_hull(), MultiPolygon(_, _) => self.as_multi_polygon().convex_hull(), - Mixed(_, _) => self.as_mixed().convex_hull(), GeometryCollection(_, _) => self.as_geometry_collection().convex_hull(), Rect(_) => self.as_rect().convex_hull(), Geometry(_) => self.as_geometry().convex_hull(), diff --git a/rust/geoarrow/src/algorithm/geo/dimensions.rs b/rust/geoarrow/src/algorithm/geo/dimensions.rs index 26565f6d..5ddc65a9 100644 --- a/rust/geoarrow/src/algorithm/geo/dimensions.rs +++ b/rust/geoarrow/src/algorithm/geo/dimensions.rs @@ -75,7 +75,6 @@ impl HasDimensions for &dyn NativeArray { MultiPoint(_, _) => HasDimensions::is_empty(self.as_multi_point()), MultiLineString(_, _) => HasDimensions::is_empty(self.as_multi_line_string()), MultiPolygon(_, _) => HasDimensions::is_empty(self.as_multi_polygon()), - Mixed(_, _) => HasDimensions::is_empty(self.as_mixed()), GeometryCollection(_, _) => HasDimensions::is_empty(self.as_geometry_collection()), Rect(_) => HasDimensions::is_empty(self.as_rect()), Geometry(_) => HasDimensions::is_empty(self.as_geometry()), @@ -106,7 +105,6 @@ impl HasDimensions for &dyn ChunkedNativeArray { MultiPoint(_, _) => HasDimensions::is_empty(self.as_multi_point()), MultiLineString(_, _) => HasDimensions::is_empty(self.as_multi_line_string()), MultiPolygon(_, _) => HasDimensions::is_empty(self.as_multi_polygon()), - Mixed(_, _) => HasDimensions::is_empty(self.as_mixed()), GeometryCollection(_, _) => HasDimensions::is_empty(self.as_geometry_collection()), Rect(_) => HasDimensions::is_empty(self.as_rect()), Geometry(_) => HasDimensions::is_empty(self.as_geometry()), diff --git a/rust/geoarrow/src/algorithm/geo/geodesic_area.rs b/rust/geoarrow/src/algorithm/geo/geodesic_area.rs index 809a1930..51ccc16c 100644 --- a/rust/geoarrow/src/algorithm/geo/geodesic_area.rs +++ b/rust/geoarrow/src/algorithm/geo/geodesic_area.rs @@ -314,7 +314,6 @@ impl GeodesicArea for &dyn NativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_area_signed(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_area_signed(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_area_signed(), - Mixed(_, XY) => self.as_mixed().geodesic_area_signed(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_area_signed(), _ => return Err(GeoArrowError::IncorrectType("".into())), }; @@ -332,7 +331,6 @@ impl GeodesicArea for &dyn NativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_area_unsigned(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_area_unsigned(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_area_unsigned(), - Mixed(_, XY) => self.as_mixed().geodesic_area_unsigned(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_area_unsigned(), _ => return Err(GeoArrowError::IncorrectType("".into())), }; @@ -350,7 +348,6 @@ impl GeodesicArea for &dyn NativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_perimeter(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_perimeter(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_perimeter(), _ => return Err(GeoArrowError::IncorrectType("".into())), }; @@ -368,7 +365,6 @@ impl GeodesicArea for &dyn NativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_perimeter_area_signed(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_perimeter_area_signed(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter_area_signed(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter_area_signed(), GeometryCollection(_, XY) => self .as_geometry_collection() .geodesic_perimeter_area_signed(), @@ -390,7 +386,6 @@ impl GeodesicArea for &dyn NativeArray { .as_multi_line_string() .geodesic_perimeter_area_unsigned(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter_area_unsigned(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter_area_unsigned(), GeometryCollection(_, XY) => self .as_geometry_collection() .geodesic_perimeter_area_unsigned(), @@ -451,7 +446,6 @@ impl GeodesicArea for &dyn ChunkedNativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_area_signed(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_area_signed(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_area_signed(), - Mixed(_, XY) => self.as_mixed().geodesic_area_signed(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_area_signed(), _ => Err(GeoArrowError::IncorrectType("".into())), } @@ -468,7 +462,6 @@ impl GeodesicArea for &dyn ChunkedNativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_area_unsigned(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_area_unsigned(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_area_unsigned(), - Mixed(_, XY) => self.as_mixed().geodesic_area_unsigned(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_area_unsigned(), _ => Err(GeoArrowError::IncorrectType("".into())), } @@ -485,7 +478,6 @@ impl GeodesicArea for &dyn ChunkedNativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_perimeter(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_perimeter(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter(), GeometryCollection(_, XY) => self.as_geometry_collection().geodesic_perimeter(), _ => Err(GeoArrowError::IncorrectType("".into())), } @@ -502,7 +494,6 @@ impl GeodesicArea for &dyn ChunkedNativeArray { MultiPoint(_, XY) => self.as_multi_point().geodesic_perimeter_area_signed(), MultiLineString(_, XY) => self.as_multi_line_string().geodesic_perimeter_area_signed(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter_area_signed(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter_area_signed(), GeometryCollection(_, XY) => self .as_geometry_collection() .geodesic_perimeter_area_signed(), @@ -523,7 +514,6 @@ impl GeodesicArea for &dyn ChunkedNativeArray { .as_multi_line_string() .geodesic_perimeter_area_unsigned(), MultiPolygon(_, XY) => self.as_multi_polygon().geodesic_perimeter_area_unsigned(), - Mixed(_, XY) => self.as_mixed().geodesic_perimeter_area_unsigned(), GeometryCollection(_, XY) => self .as_geometry_collection() .geodesic_perimeter_area_unsigned(), diff --git a/rust/geoarrow/src/algorithm/geo/minimum_rotated_rect.rs b/rust/geoarrow/src/algorithm/geo/minimum_rotated_rect.rs index 3249e7ee..6e1c67f8 100644 --- a/rust/geoarrow/src/algorithm/geo/minimum_rotated_rect.rs +++ b/rust/geoarrow/src/algorithm/geo/minimum_rotated_rect.rs @@ -92,7 +92,6 @@ impl MinimumRotatedRect for &dyn NativeArray { MultiPoint(_, XY) => self.as_multi_point().minimum_rotated_rect(), MultiLineString(_, XY) => self.as_multi_line_string().minimum_rotated_rect(), MultiPolygon(_, XY) => self.as_multi_polygon().minimum_rotated_rect(), - Mixed(_, XY) => self.as_mixed().minimum_rotated_rect(), GeometryCollection(_, XY) => self.as_geometry_collection().minimum_rotated_rect(), _ => return Err(GeoArrowError::IncorrectType("".into())), }; @@ -123,7 +122,6 @@ impl MinimumRotatedRect for &dyn ChunkedNativeArray { MultiPoint(_, XY) => self.as_multi_point().minimum_rotated_rect(), MultiLineString(_, XY) => self.as_multi_line_string().minimum_rotated_rect(), MultiPolygon(_, XY) => self.as_multi_polygon().minimum_rotated_rect(), - Mixed(_, XY) => self.as_mixed().minimum_rotated_rect(), GeometryCollection(_, XY) => self.as_geometry_collection().minimum_rotated_rect(), _ => Err(GeoArrowError::IncorrectType("".into())), } diff --git a/rust/geoarrow/src/algorithm/geo_index/rtree.rs b/rust/geoarrow/src/algorithm/geo_index/rtree.rs index a3e4458e..fe3f42fa 100644 --- a/rust/geoarrow/src/algorithm/geo_index/rtree.rs +++ b/rust/geoarrow/src/algorithm/geo_index/rtree.rs @@ -72,7 +72,6 @@ impl RTree for &dyn NativeArray { MultiPoint(_, _) => impl_method!(as_multi_point), MultiLineString(_, _) => impl_method!(as_multi_line_string), MultiPolygon(_, _) => impl_method!(as_multi_polygon), - Mixed(_, _) => impl_method!(as_mixed), GeometryCollection(_, _) => impl_method!(as_geometry_collection), Rect(_) => impl_method!(as_rect), Geometry(_) => impl_method!(as_geometry), @@ -107,7 +106,6 @@ impl RTree for &dyn ChunkedNativeArray { MultiPoint(_, _) => impl_method!(as_multi_point), MultiLineString(_, _) => impl_method!(as_multi_line_string), MultiPolygon(_, _) => impl_method!(as_multi_polygon), - Mixed(_, _) => impl_method!(as_mixed), GeometryCollection(_, _) => impl_method!(as_geometry_collection), Rect(_) => impl_method!(as_rect), Geometry(_) => impl_method!(as_geometry), diff --git a/rust/geoarrow/src/algorithm/geos/area.rs b/rust/geoarrow/src/algorithm/geos/area.rs index bbb1ef85..700977c8 100644 --- a/rust/geoarrow/src/algorithm/geos/area.rs +++ b/rust/geoarrow/src/algorithm/geos/area.rs @@ -66,7 +66,6 @@ impl Area for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().area(), MultiLineString(_, _) => self.as_multi_line_string().area(), MultiPolygon(_, _) => self.as_multi_polygon().area(), - Mixed(_, _) => self.as_mixed().area(), GeometryCollection(_, _) => self.as_geometry_collection().area(), Rect(_) => self.as_rect().area(), Geometry(_) => self.as_geometry().area(), diff --git a/rust/geoarrow/src/algorithm/geos/is_empty.rs b/rust/geoarrow/src/algorithm/geos/is_empty.rs index fcf8c2fe..dfb9d82e 100644 --- a/rust/geoarrow/src/algorithm/geos/is_empty.rs +++ b/rust/geoarrow/src/algorithm/geos/is_empty.rs @@ -51,7 +51,6 @@ impl IsEmpty for &dyn NativeArray { MultiPoint(_, _) => IsEmpty::is_empty(self.as_multi_point()), MultiLineString(_, _) => IsEmpty::is_empty(self.as_multi_line_string()), MultiPolygon(_, _) => IsEmpty::is_empty(self.as_multi_polygon()), - Mixed(_, _) => IsEmpty::is_empty(self.as_mixed()), GeometryCollection(_, _) => IsEmpty::is_empty(self.as_geometry_collection()), Rect(_) => IsEmpty::is_empty(self.as_rect()), Geometry(_) => IsEmpty::is_empty(self.as_geometry()), diff --git a/rust/geoarrow/src/algorithm/geos/is_ring.rs b/rust/geoarrow/src/algorithm/geos/is_ring.rs index e3a8af45..17d26206 100644 --- a/rust/geoarrow/src/algorithm/geos/is_ring.rs +++ b/rust/geoarrow/src/algorithm/geos/is_ring.rs @@ -51,7 +51,6 @@ impl IsRing for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().is_ring(), MultiLineString(_, _) => self.as_multi_line_string().is_ring(), MultiPolygon(_, _) => self.as_multi_polygon().is_ring(), - Mixed(_, _) => self.as_mixed().is_ring(), GeometryCollection(_, _) => self.as_geometry_collection().is_ring(), Rect(_) => self.as_rect().is_ring(), Geometry(_) => self.as_geometry().is_ring(), diff --git a/rust/geoarrow/src/algorithm/geos/is_simple.rs b/rust/geoarrow/src/algorithm/geos/is_simple.rs index 377736c2..5dd831e1 100644 --- a/rust/geoarrow/src/algorithm/geos/is_simple.rs +++ b/rust/geoarrow/src/algorithm/geos/is_simple.rs @@ -51,7 +51,6 @@ impl IsSimple for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().is_simple(), MultiLineString(_, _) => self.as_multi_line_string().is_simple(), MultiPolygon(_, _) => self.as_multi_polygon().is_simple(), - Mixed(_, _) => self.as_mixed().is_simple(), GeometryCollection(_, _) => self.as_geometry_collection().is_simple(), Rect(_) => self.as_rect().is_simple(), Geometry(_) => self.as_geometry().is_simple(), diff --git a/rust/geoarrow/src/algorithm/geos/is_valid.rs b/rust/geoarrow/src/algorithm/geos/is_valid.rs index 988dccb0..e1a02d91 100644 --- a/rust/geoarrow/src/algorithm/geos/is_valid.rs +++ b/rust/geoarrow/src/algorithm/geos/is_valid.rs @@ -52,7 +52,6 @@ impl IsValid for &dyn NativeArray { MultiPoint(_, _) => IsValid::is_valid(self.as_multi_point()), MultiLineString(_, _) => IsValid::is_valid(self.as_multi_line_string()), MultiPolygon(_, _) => IsValid::is_valid(self.as_multi_polygon()), - Mixed(_, _) => IsValid::is_valid(self.as_mixed()), GeometryCollection(_, _) => IsValid::is_valid(self.as_geometry_collection()), Rect(_) => IsValid::is_valid(self.as_rect()), Geometry(_) => IsValid::is_valid(self.as_geometry()), diff --git a/rust/geoarrow/src/algorithm/geos/length.rs b/rust/geoarrow/src/algorithm/geos/length.rs index 6e5f248d..b2e6c5f8 100644 --- a/rust/geoarrow/src/algorithm/geos/length.rs +++ b/rust/geoarrow/src/algorithm/geos/length.rs @@ -59,7 +59,6 @@ impl Length for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().length(), MultiLineString(_, _) => self.as_multi_line_string().length(), MultiPolygon(_, _) => self.as_multi_polygon().length(), - Mixed(_, _) => self.as_mixed().length(), GeometryCollection(_, _) => self.as_geometry_collection().length(), Rect(_) => self.as_rect().length(), Geometry(_) => self.as_geometry().length(), diff --git a/rust/geoarrow/src/algorithm/native/cast.rs b/rust/geoarrow/src/algorithm/native/cast.rs index 33dce570..3e0aa9ef 100644 --- a/rust/geoarrow/src/algorithm/native/cast.rs +++ b/rust/geoarrow/src/algorithm/native/cast.rs @@ -64,7 +64,6 @@ impl Cast for PointArray { match to_type { Point(_, _) => Ok(Arc::new(array)), MultiPoint(_, _) => Ok(Arc::new(MultiPointArray::from(array))), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -85,7 +84,6 @@ impl Cast for LineStringArray { match to_type { LineString(_, _) => Ok(Arc::new(array)), MultiLineString(_, _) => Ok(Arc::new(MultiLineStringArray::from(array))), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -106,7 +104,6 @@ impl Cast for PolygonArray { match to_type { Polygon(_, _) => Ok(Arc::new(array)), MultiPolygon(_, _) => Ok(Arc::new(MultiPolygonArray::from(array))), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -127,7 +124,6 @@ impl Cast for MultiPointArray { match to_type { Point(_, _) => Ok(Arc::new(PointArray::try_from(array)?)), MultiPoint(_, _) => Ok(Arc::new(array)), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -147,7 +143,6 @@ impl Cast for MultiLineStringArray { match to_type { LineString(_, _) => Ok(Arc::new(LineStringArray::try_from(array)?)), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -167,7 +162,6 @@ impl Cast for MultiPolygonArray { match to_type { Polygon(_, _) => Ok(Arc::new(PolygonArray::try_from(array)?)), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::from(array))), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -192,7 +186,6 @@ impl Cast for MixedGeometryArray { MultiPoint(_, _) => Ok(Arc::new(MultiPointArray::try_from(array)?)), MultiLineString(_, _) => Ok(Arc::new(MultiLineStringArray::try_from(array)?)), MultiPolygon(_, _) => Ok(Arc::new(MultiPolygonArray::try_from(array)?)), - Mixed(_, _) => Ok(Arc::new(array)), GeometryCollection(_, _) => Ok(Arc::new(GeometryCollectionArray::from(array))), dt => Err(GeoArrowError::General(format!( "invalid cast to type {dt:?}" @@ -216,7 +209,6 @@ impl Cast for GeometryCollectionArray { MultiPoint(_, _) => Ok(Arc::new(MultiPointArray::try_from(array)?)), MultiLineString(_, _) => Ok(Arc::new(MultiLineStringArray::try_from(array)?)), MultiPolygon(_, _) => Ok(Arc::new(MultiPolygonArray::try_from(array)?)), - Mixed(_, _) => Ok(Arc::new(MixedGeometryArray::try_from(array)?)), GeometryCollection(_, _) => Ok(Arc::new(array)), Geometry(_) => Ok(Arc::new(GeometryArray::from(array))), dt => Err(GeoArrowError::General(format!( @@ -255,7 +247,6 @@ impl Cast for &dyn NativeArray { MultiPoint(_, _) => self.as_ref().as_multi_point().cast(to_type), MultiLineString(_, _) => self.as_ref().as_multi_line_string().cast(to_type), MultiPolygon(_, _) => self.as_ref().as_multi_polygon().cast(to_type), - Mixed(_, _) => self.as_ref().as_mixed().cast(to_type), GeometryCollection(_, _) => self.as_ref().as_geometry_collection().cast(to_type), Geometry(_) => self.as_ref().as_geometry().cast(to_type), _ => todo!(), @@ -291,7 +282,6 @@ macro_rules! impl_chunked_cast { MultiPoint(_, _) => impl_cast!(as_multi_point), MultiLineString(_, _) => impl_cast!(as_multi_line_string), MultiPolygon(_, _) => impl_cast!(as_multi_polygon), - Mixed(_, _) => impl_cast!(as_mixed), GeometryCollection(_, _) => impl_cast!(as_geometry_collection), Rect(_) => impl_cast!(as_rect), Geometry(_) => impl_cast!(as_geometry), diff --git a/rust/geoarrow/src/algorithm/native/downcast.rs b/rust/geoarrow/src/algorithm/native/downcast.rs index 5704afe8..d099d50e 100644 --- a/rust/geoarrow/src/algorithm/native/downcast.rs +++ b/rust/geoarrow/src/algorithm/native/downcast.rs @@ -276,7 +276,6 @@ impl Downcast for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().downcasted_data_type(), MultiLineString(_, _) => self.as_multi_line_string().downcasted_data_type(), MultiPolygon(_, _) => self.as_multi_polygon().downcasted_data_type(), - Mixed(_, _) => self.as_mixed().downcasted_data_type(), GeometryCollection(_, _) => self.as_geometry_collection().downcasted_data_type(), Rect(_) => self.as_rect().downcasted_data_type(), Geometry(_) => self.as_geometry().downcasted_data_type(), @@ -293,7 +292,6 @@ impl Downcast for &dyn NativeArray { MultiPoint(_, _) => Ok(self.as_multi_point().downcast()), MultiLineString(_, _) => Ok(self.as_multi_line_string().downcast()), MultiPolygon(_, _) => Ok(self.as_multi_polygon().downcast()), - Mixed(_, _) => self.as_mixed().downcast(), GeometryCollection(_, _) => self.as_geometry_collection().downcast(), Rect(_) => Ok(self.as_rect().downcast()), Geometry(_) => self.as_geometry().downcast(), @@ -431,7 +429,6 @@ impl Downcast for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().downcasted_data_type(), MultiLineString(_, _) => self.as_multi_line_string().downcasted_data_type(), MultiPolygon(_, _) => self.as_multi_polygon().downcasted_data_type(), - Mixed(_, _) => self.as_mixed().downcasted_data_type(), GeometryCollection(_, _) => self.as_geometry_collection().downcasted_data_type(), Rect(_) => self.as_rect().downcasted_data_type(), Geometry(_) => self.as_geometry().downcasted_data_type(), @@ -448,7 +445,6 @@ impl Downcast for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().downcast(), MultiLineString(_, _) => self.as_multi_line_string().downcast(), MultiPolygon(_, _) => self.as_multi_polygon().downcast(), - Mixed(_, _) => self.as_mixed().downcast(), GeometryCollection(_, _) => self.as_geometry_collection().downcast(), Rect(_) => self.as_rect().downcast(), Geometry(_) => self.as_geometry().downcast(), diff --git a/rust/geoarrow/src/algorithm/native/explode.rs b/rust/geoarrow/src/algorithm/native/explode.rs index 153f47db..c8e010d9 100644 --- a/rust/geoarrow/src/algorithm/native/explode.rs +++ b/rust/geoarrow/src/algorithm/native/explode.rs @@ -197,7 +197,6 @@ impl Explode for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().explode(), MultiLineString(_, _) => self.as_multi_line_string().explode(), MultiPolygon(_, _) => self.as_multi_polygon().explode(), - Mixed(_, _) => self.as_mixed().explode(), GeometryCollection(_, _) => self.as_geometry_collection().explode(), Rect(_) => self.as_rect().explode(), _ => todo!("explode unknown"), diff --git a/rust/geoarrow/src/algorithm/native/map_coords.rs b/rust/geoarrow/src/algorithm/native/map_coords.rs index 20d2b042..a85a6b5f 100644 --- a/rust/geoarrow/src/algorithm/native/map_coords.rs +++ b/rust/geoarrow/src/algorithm/native/map_coords.rs @@ -463,7 +463,6 @@ impl MapCoords for &dyn NativeArray { MultiPoint(_, XY) => Arc::new(self.as_multi_point().try_map_coords(map_op)?), MultiLineString(_, XY) => Arc::new(self.as_multi_line_string().try_map_coords(map_op)?), MultiPolygon(_, XY) => Arc::new(self.as_multi_polygon().try_map_coords(map_op)?), - Mixed(_, XY) => Arc::new(self.as_mixed().try_map_coords(map_op)?), GeometryCollection(_, XY) => { Arc::new(self.as_geometry_collection().try_map_coords(map_op)?) } @@ -618,7 +617,6 @@ impl MapCoords for &dyn ChunkedNativeArray { MultiPoint(_, XY) => Arc::new(self.as_multi_point().try_map_coords(map_op)?), MultiLineString(_, XY) => Arc::new(self.as_multi_line_string().try_map_coords(map_op)?), MultiPolygon(_, XY) => Arc::new(self.as_multi_polygon().try_map_coords(map_op)?), - Mixed(_, XY) => Arc::new(self.as_mixed().try_map_coords(map_op)?), GeometryCollection(_, XY) => { Arc::new(self.as_geometry_collection().try_map_coords(map_op)?) } diff --git a/rust/geoarrow/src/algorithm/native/take.rs b/rust/geoarrow/src/algorithm/native/take.rs index 5e279619..da4e8995 100644 --- a/rust/geoarrow/src/algorithm/native/take.rs +++ b/rust/geoarrow/src/algorithm/native/take.rs @@ -232,7 +232,6 @@ impl Take for &dyn NativeArray { MultiPoint(_, XY) => Arc::new(self.as_multi_point().take(indices)?), MultiLineString(_, XY) => Arc::new(self.as_multi_line_string().take(indices)?), MultiPolygon(_, XY) => Arc::new(self.as_multi_polygon().take(indices)?), - Mixed(_, XY) => Arc::new(self.as_mixed().take(indices)?), GeometryCollection(_, XY) => Arc::new(self.as_geometry_collection().take(indices)?), _ => return Err(GeoArrowError::IncorrectType("".into())), }; @@ -250,7 +249,6 @@ impl Take for &dyn NativeArray { MultiPoint(_, XY) => Arc::new(self.as_multi_point().take_range(range)?), MultiLineString(_, XY) => Arc::new(self.as_multi_line_string().take_range(range)?), MultiPolygon(_, XY) => Arc::new(self.as_multi_polygon().take_range(range)?), - Mixed(_, XY) => Arc::new(self.as_mixed().take_range(range)?), GeometryCollection(_, XY) => Arc::new(self.as_geometry_collection().take_range(range)?), _ => return Err(GeoArrowError::IncorrectType("".into())), }; diff --git a/rust/geoarrow/src/algorithm/native/total_bounds.rs b/rust/geoarrow/src/algorithm/native/total_bounds.rs index dc0f5356..db7f6bc4 100644 --- a/rust/geoarrow/src/algorithm/native/total_bounds.rs +++ b/rust/geoarrow/src/algorithm/native/total_bounds.rs @@ -74,7 +74,6 @@ impl TotalBounds for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().total_bounds(), MultiLineString(_, _) => self.as_multi_line_string().total_bounds(), MultiPolygon(_, _) => self.as_multi_polygon().total_bounds(), - Mixed(_, _) => self.as_mixed().total_bounds(), GeometryCollection(_, _) => self.as_geometry_collection().total_bounds(), Rect(_) => self.as_rect().total_bounds(), Geometry(_) => self.as_geometry().total_bounds(), @@ -104,7 +103,6 @@ impl TotalBounds for &dyn ChunkedNativeArray { MultiPoint(_, _) => self.as_multi_point().total_bounds(), MultiLineString(_, _) => self.as_multi_line_string().total_bounds(), MultiPolygon(_, _) => self.as_multi_polygon().total_bounds(), - Mixed(_, _) => self.as_mixed().total_bounds(), GeometryCollection(_, _) => self.as_geometry_collection().total_bounds(), Rect(_) => self.as_rect().total_bounds(), Geometry(_) => self.as_geometry().total_bounds(), diff --git a/rust/geoarrow/src/array/cast.rs b/rust/geoarrow/src/array/cast.rs index e90df2d4..4e48b573 100644 --- a/rust/geoarrow/src/array/cast.rs +++ b/rust/geoarrow/src/array/cast.rs @@ -59,16 +59,6 @@ pub trait AsNativeArray { self.as_multi_polygon_opt().unwrap() } - /// Downcast this to a [`MixedGeometryArray`] with `i32` offsets returning `None` if not - /// possible - fn as_mixed_opt(&self) -> Option<&MixedGeometryArray>; - - /// Downcast this to a [`MixedGeometryArray`] with `i32` offsets panicking if not possible - #[inline] - fn as_mixed(&self) -> &MixedGeometryArray { - self.as_mixed_opt().unwrap() - } - /// Downcast this to a [`GeometryCollectionArray`] with `i32` offsets returning `None` if not /// possible fn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray>; @@ -129,11 +119,6 @@ impl AsNativeArray for &dyn NativeArray { self.as_any().downcast_ref::() } - #[inline] - fn as_mixed_opt(&self) -> Option<&MixedGeometryArray> { - self.as_any().downcast_ref::() - } - #[inline] fn as_geometry_collection_opt(&self) -> Option<&GeometryCollectionArray> { self.as_any().downcast_ref::() @@ -240,16 +225,6 @@ pub trait AsChunkedNativeArray { self.as_multi_polygon_opt().unwrap() } - /// Downcast this to a [`ChunkedMixedGeometryArray`] with `i32` offsets returning `None` if not - /// possible - fn as_mixed_opt(&self) -> Option<&ChunkedMixedGeometryArray>; - - /// Downcast this to a [`ChunkedMixedGeometryArray`] with `i32` offsets panicking if not possible - #[inline] - fn as_mixed(&self) -> &ChunkedMixedGeometryArray { - self.as_mixed_opt().unwrap() - } - /// Downcast this to a [`ChunkedGeometryCollectionArray`] with `i32` offsets returning `None` if not /// possible fn as_geometry_collection_opt(&self) -> Option<&ChunkedGeometryCollectionArray>; @@ -310,11 +285,6 @@ impl AsChunkedNativeArray for &dyn ChunkedNativeArray { self.as_any().downcast_ref::() } - #[inline] - fn as_mixed_opt(&self) -> Option<&ChunkedMixedGeometryArray> { - self.as_any().downcast_ref::() - } - #[inline] fn as_geometry_collection_opt(&self) -> Option<&ChunkedGeometryCollectionArray> { self.as_any() diff --git a/rust/geoarrow/src/array/coord/interleaved/array.rs b/rust/geoarrow/src/array/coord/interleaved/array.rs index afef10aa..02cec0f9 100644 --- a/rust/geoarrow/src/array/coord/interleaved/array.rs +++ b/rust/geoarrow/src/array/coord/interleaved/array.rs @@ -132,7 +132,8 @@ impl InterleavedCoordBuffer { pub fn from_arrow(array: &FixedSizeListArray, dim: Dimension) -> Result { if array.value_length() != dim.size() as i32 { return Err(GeoArrowError::General( - "Expected this FixedSizeListArray to have size 2".to_string(), + format!( "Expected the FixedSizeListArray to match the dimension. Array length is {}, dimension is: {:?} have size 2", array.value_length(), dim) + )); } diff --git a/rust/geoarrow/src/array/dynamic.rs b/rust/geoarrow/src/array/dynamic.rs index f0a4a892..c1707af2 100644 --- a/rust/geoarrow/src/array/dynamic.rs +++ b/rust/geoarrow/src/array/dynamic.rs @@ -38,7 +38,6 @@ impl NativeArrayDyn { MultiPoint(_, _) => Arc::new(MultiPointArray::try_from((array, field))?), MultiLineString(_, _) => Arc::new(MultiLineStringArray::try_from((array, field))?), MultiPolygon(_, _) => Arc::new(MultiPolygonArray::try_from((array, field))?), - Mixed(_, _) => Arc::new(MixedGeometryArray::try_from((array, field))?), GeometryCollection(_, _) => { Arc::new(GeometryCollectionArray::try_from((array, field))?) } diff --git a/rust/geoarrow/src/array/geometry/array.rs b/rust/geoarrow/src/array/geometry/array.rs index cd804ff6..72b52146 100644 --- a/rust/geoarrow/src/array/geometry/array.rs +++ b/rust/geoarrow/src/array/geometry/array.rs @@ -8,10 +8,7 @@ use arrow_schema::{DataType, Field, UnionMode}; use crate::array::geometry::GeometryBuilder; use crate::array::geometry::GeometryCapacity; use crate::array::metadata::ArrayMetadata; -use crate::array::{ - CoordType, GeometryCollectionArray, LineStringArray, MixedGeometryArray, MultiLineStringArray, - MultiPointArray, MultiPolygonArray, PointArray, PolygonArray, WKBArray, -}; +use crate::array::*; use crate::datatypes::{Dimension, NativeType}; use crate::error::{GeoArrowError, Result}; use crate::scalar::Geometry; @@ -972,6 +969,93 @@ impl_to_geometry_array!( impl_to_geometry_array!(MultiPolygonArray, 1, 11, mpolygon_xy, mpolygon_xyz); impl_to_geometry_array!(GeometryCollectionArray, 1, 11, gc_xy, gc_xyz); +impl From for GeometryArray { + fn from(value: MixedGeometryArray) -> Self { + use Dimension::*; + + // TODO: include slice offset + let mut point_xy: Option = None; + let mut line_string_xy: Option = None; + let mut polygon_xy: Option = None; + let mut mpoint_xy: Option = None; + let mut mline_string_xy: Option = None; + let mut mpolygon_xy: Option = None; + + let mut point_xyz: Option = None; + let mut line_string_xyz: Option = None; + let mut polygon_xyz: Option = None; + let mut mpoint_xyz: Option = None; + let mut mline_string_xyz: Option = None; + let mut mpolygon_xyz: Option = None; + + let coord_type = value.coord_type(); + match value.dimension() { + XY => { + point_xy = Some(value.points); + line_string_xy = Some(value.line_strings); + polygon_xy = Some(value.polygons); + mpoint_xy = Some(value.multi_points); + mline_string_xy = Some(value.multi_line_strings); + mpolygon_xy = Some(value.multi_polygons); + } + XYZ => { + point_xyz = Some(value.points); + line_string_xyz = Some(value.line_strings); + polygon_xyz = Some(value.polygons); + mpoint_xyz = Some(value.multi_points); + mline_string_xyz = Some(value.multi_line_strings); + mpolygon_xyz = Some(value.multi_polygons); + } + } + + Self::new( + value.type_ids, + value.offsets, + point_xy.unwrap_or( + PointBuilder::new_with_options(XY, coord_type, Default::default()).finish(), + ), + line_string_xy.unwrap_or( + LineStringBuilder::new_with_options(XY, coord_type, Default::default()).finish(), + ), + polygon_xy.unwrap_or( + PolygonBuilder::new_with_options(XY, coord_type, Default::default()).finish(), + ), + mpoint_xy.unwrap_or( + MultiPointBuilder::new_with_options(XY, coord_type, Default::default()).finish(), + ), + mline_string_xy.unwrap_or( + MultiLineStringBuilder::new_with_options(XY, coord_type, Default::default()) + .finish(), + ), + mpolygon_xy.unwrap_or( + MultiPolygonBuilder::new_with_options(XY, coord_type, Default::default()).finish(), + ), + Default::default(), + point_xyz.unwrap_or( + PointBuilder::new_with_options(XYZ, coord_type, Default::default()).finish(), + ), + line_string_xyz.unwrap_or( + LineStringBuilder::new_with_options(XYZ, coord_type, Default::default()).finish(), + ), + polygon_xyz.unwrap_or( + PolygonBuilder::new_with_options(XYZ, coord_type, Default::default()).finish(), + ), + mpoint_xyz.unwrap_or( + MultiPointBuilder::new_with_options(XYZ, coord_type, Default::default()).finish(), + ), + mline_string_xyz.unwrap_or( + MultiLineStringBuilder::new_with_options(XYZ, coord_type, Default::default()) + .finish(), + ), + mpolygon_xyz.unwrap_or( + MultiPolygonBuilder::new_with_options(XYZ, coord_type, Default::default()).finish(), + ), + Default::default(), + value.metadata, + ) + } +} + impl TryFrom for MixedGeometryArray { type Error = GeoArrowError; diff --git a/rust/geoarrow/src/array/mixed/array.rs b/rust/geoarrow/src/array/mixed/array.rs index 0f2d4be3..f50bc1f0 100644 --- a/rust/geoarrow/src/array/mixed/array.rs +++ b/rust/geoarrow/src/array/mixed/array.rs @@ -1,4 +1,4 @@ -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use std::sync::Arc; use arrow_array::{Array, OffsetSizeTrait, UnionArray}; @@ -13,7 +13,7 @@ use crate::array::{ CoordType, GeometryCollectionArray, LineStringArray, MultiLineStringArray, MultiPointArray, MultiPolygonArray, PointArray, PolygonArray, WKBArray, }; -use crate::datatypes::{Dimension, NativeType}; +use crate::datatypes::{mixed_data_type, Dimension, NativeType}; use crate::error::{GeoArrowError, Result}; use crate::scalar::Geometry; use crate::trait_::{ArrayAccessor, GeometryArraySelfMethods, IntoArrow, NativeGeometryAccessor}; @@ -55,8 +55,10 @@ use geo_traits::GeometryTrait; /// - 37: GeometryCollection ZM #[derive(Debug, Clone, PartialEq)] pub struct MixedGeometryArray { - /// Always NativeType::Mixed - data_type: NativeType, + // We store the coord type and dimension separately because there's no NativeType::Mixed + // variant + coord_type: CoordType, + dim: Dimension, pub(crate) metadata: Arc, @@ -124,9 +126,9 @@ impl MixedGeometryArray { let dim = dimensions.into_iter().next().unwrap(); - let data_type = NativeType::Mixed(coord_type, dim); Self { - data_type, + coord_type, + dim, type_ids, offsets, points, @@ -366,7 +368,8 @@ impl MixedGeometryArray { "offset + length may not exceed length of array" ); Self { - data_type: self.data_type, + coord_type: self.coord_type, + dim: self.dim, type_ids: self.type_ids.slice(offset, length), offsets: self.offsets.slice(offset, length), points: self.points.clone(), @@ -429,18 +432,33 @@ impl ArrayBase for MixedGeometryArray { } fn storage_type(&self) -> DataType { - self.data_type.to_data_type() + mixed_data_type(self.coord_type, self.dim) } fn extension_field(&self) -> Arc { - Arc::new( - self.data_type - .to_field_with_metadata("geometry", true, &self.metadata), - ) + let name = "geometry"; + let nullable = true; + let array_metadata = &self.metadata; + let data_type = self.storage_type(); + + // Note: this is currently copied from to_field_with_metadata + let extension_name = self.extension_name(); + let mut metadata = HashMap::with_capacity(2); + metadata.insert( + "ARROW:extension:name".to_string(), + extension_name.to_string(), + ); + if array_metadata.should_serialize() { + metadata.insert( + "ARROW:extension:metadata".to_string(), + serde_json::to_string(array_metadata.as_ref()).unwrap(), + ); + } + Arc::new(Field::new(name, data_type, nullable).with_metadata(metadata)) } fn extension_name(&self) -> &str { - self.data_type.extension_name() + "geoarrow.geometry" } fn into_array_ref(self) -> Arc { @@ -471,11 +489,16 @@ impl ArrayBase for MixedGeometryArray { impl NativeArray for MixedGeometryArray { fn data_type(&self) -> NativeType { - self.data_type + // self.data_type + todo!("mixed array does not have native type") + } + + fn dimension(&self) -> Dimension { + self.dim } fn coord_type(&self) -> crate::array::CoordType { - self.data_type.coord_type() + self.coord_type } fn to_coord_type(&self, coord_type: CoordType) -> Arc { @@ -583,7 +606,7 @@ impl IntoArrow for MixedGeometryArray { type ArrowArray = UnionArray; fn into_arrow(self) -> Self::ArrowArray { - let union_fields = match self.data_type.to_data_type() { + let union_fields = match mixed_data_type(self.coord_type, self.dim) { DataType::Union(union_fields, _) => union_fields, _ => unreachable!(), }; diff --git a/rust/geoarrow/src/array/mod.rs b/rust/geoarrow/src/array/mod.rs index 595fc3a4..b445f3b8 100644 --- a/rust/geoarrow/src/array/mod.rs +++ b/rust/geoarrow/src/array/mod.rs @@ -14,7 +14,8 @@ pub use geometrycollection::{ GeometryCollectionArray, GeometryCollectionBuilder, GeometryCollectionCapacity, }; pub use linestring::{LineStringArray, LineStringBuilder, LineStringCapacity}; -pub use mixed::{MixedCapacity, MixedGeometryArray, MixedGeometryBuilder}; +// Don't expose in the public API. Prefer GeometryArray +pub(crate) use mixed::{MixedCapacity, MixedGeometryArray, MixedGeometryBuilder}; pub use multilinestring::{MultiLineStringArray, MultiLineStringBuilder, MultiLineStringCapacity}; pub use multipoint::{MultiPointArray, MultiPointBuilder, MultiPointCapacity}; pub use multipolygon::{MultiPolygonArray, MultiPolygonBuilder, MultiPolygonCapacity}; diff --git a/rust/geoarrow/src/chunked_array/dynamic.rs b/rust/geoarrow/src/chunked_array/dynamic.rs index 057945ec..5cc9393a 100644 --- a/rust/geoarrow/src/chunked_array/dynamic.rs +++ b/rust/geoarrow/src/chunked_array/dynamic.rs @@ -64,7 +64,6 @@ impl ChunkedNativeArrayDyn { MultiPoint(_, _) => impl_downcast!(MultiPointArray), MultiLineString(_, _) => impl_downcast!(MultiLineStringArray), MultiPolygon(_, _) => impl_downcast!(MultiPolygonArray), - Mixed(_, _) => impl_downcast!(MixedGeometryArray), GeometryCollection(_, _) => { impl_downcast!(GeometryCollectionArray) } @@ -120,7 +119,6 @@ impl ChunkedNativeArrayDyn { MultiPoint(_, _) => impl_downcast!(as_multi_point), MultiLineString(_, _) => impl_downcast!(as_multi_line_string), MultiPolygon(_, _) => impl_downcast!(as_multi_polygon), - Mixed(_, _) => impl_downcast!(as_mixed), GeometryCollection(_, _) => impl_downcast!(as_geometry_collection), Rect(_) => impl_downcast!(as_rect), Geometry(_) => impl_downcast!(as_geometry), diff --git a/rust/geoarrow/src/chunked_array/mod.rs b/rust/geoarrow/src/chunked_array/mod.rs index bff05268..1c68d5d1 100644 --- a/rust/geoarrow/src/chunked_array/mod.rs +++ b/rust/geoarrow/src/chunked_array/mod.rs @@ -592,7 +592,7 @@ pub type ChunkedMultiLineStringArray = ChunkedGeometryArray; /// A chunked mixed geometry array. -pub type ChunkedMixedGeometryArray = ChunkedGeometryArray; +pub(crate) type ChunkedMixedGeometryArray = ChunkedGeometryArray; /// A chunked geometry collection array. pub type ChunkedGeometryCollectionArray = ChunkedGeometryArray; /// A chunked rect array. diff --git a/rust/geoarrow/src/datatypes.rs b/rust/geoarrow/src/datatypes.rs index 666756f3..8857648a 100644 --- a/rust/geoarrow/src/datatypes.rs +++ b/rust/geoarrow/src/datatypes.rs @@ -129,11 +129,10 @@ pub enum NativeType { /// offsets. MultiPolygon(CoordType, Dimension), - /// Represents a [MixedGeometryArray][crate::array::MixedGeometryArray] or - /// [ChunkedMixedGeometryArray][crate::chunked_array::ChunkedMixedGeometryArray] with `i32` - /// offsets. - Mixed(CoordType, Dimension), - + // Represents a [MixedGeometryArray][crate::array::MixedGeometryArray] or + // [ChunkedMixedGeometryArray][crate::chunked_array::ChunkedMixedGeometryArray] with `i32` + // offsets. + // Mixed(CoordType, Dimension), /// Represents a [GeometryCollectionArray][crate::array::GeometryCollectionArray] or /// [ChunkedGeometryCollectionArray][crate::chunked_array::ChunkedGeometryCollectionArray] with /// `i32` offsets. @@ -244,7 +243,7 @@ fn multi_polygon_data_type(coord_type: CoordType, dim: Dimension) -> DataType { DataType::List(polygons_field) } -fn mixed_data_type(coord_type: CoordType, dim: Dimension) -> DataType { +pub(crate) fn mixed_data_type(coord_type: CoordType, dim: Dimension) -> DataType { let mut fields = vec![]; let mut type_ids = vec![]; @@ -391,7 +390,6 @@ impl NativeType { MultiPoint(ct, _) => *ct, MultiLineString(ct, _) => *ct, MultiPolygon(ct, _) => *ct, - Mixed(ct, _) => *ct, GeometryCollection(ct, _) => *ct, Rect(_) => CoordType::Separated, Geometry(ct) => *ct, @@ -410,7 +408,6 @@ impl NativeType { MultiPoint(_, dim) => Some(*dim), MultiLineString(_, dim) => Some(*dim), MultiPolygon(_, dim) => Some(*dim), - Mixed(_, dim) => Some(*dim), GeometryCollection(_, dim) => Some(*dim), Rect(dim) => Some(*dim), Geometry(_) => None, @@ -440,7 +437,6 @@ impl NativeType { MultiPoint(coord_type, dim) => multi_point_data_type(*coord_type, *dim), MultiLineString(coord_type, dim) => multi_line_string_data_type(*coord_type, *dim), MultiPolygon(coord_type, dim) => multi_polygon_data_type(*coord_type, *dim), - Mixed(coord_type, dim) => mixed_data_type(*coord_type, *dim), GeometryCollection(coord_type, dim) => geometry_collection_data_type(*coord_type, *dim), Rect(dim) => rect_data_type(*dim), Geometry(coord_type) => unknown_data_type(*coord_type), @@ -466,7 +462,6 @@ impl NativeType { MultiPoint(_, _) => "geoarrow.multipoint", MultiLineString(_, _) => "geoarrow.multilinestring", MultiPolygon(_, _) => "geoarrow.multipolygon", - Mixed(_, _) => "geoarrow.geometry", GeometryCollection(_, _) => "geoarrow.geometrycollection", Rect(_) => "geoarrow.box", Geometry(_) => "geoarrow.geometry", @@ -551,7 +546,6 @@ impl NativeType { MultiPoint(_, dim) => MultiPoint(coord_type, dim), MultiLineString(_, dim) => MultiLineString(coord_type, dim), MultiPolygon(_, dim) => MultiPolygon(coord_type, dim), - Mixed(_, dim) => Mixed(coord_type, dim), GeometryCollection(_, dim) => GeometryCollection(coord_type, dim), Rect(dim) => Rect(dim), Geometry(_) => Geometry(coord_type), @@ -577,7 +571,6 @@ impl NativeType { MultiPoint(coord_type, _) => MultiPoint(coord_type, dim), MultiLineString(coord_type, _) => MultiLineString(coord_type, dim), MultiPolygon(coord_type, _) => MultiPolygon(coord_type, dim), - Mixed(coord_type, _) => Mixed(coord_type, dim), GeometryCollection(coord_type, _) => GeometryCollection(coord_type, dim), Rect(_) => Rect(dim), Geometry(coord_type) => Geometry(coord_type), @@ -794,7 +787,7 @@ fn parse_multi_polygon(field: &Field) -> Result { } } -fn parse_mixed(field: &Field) -> Result { +fn parse_mixed(field: &Field) -> Result<(CoordType, Dimension)> { match field.data_type() { DataType::Union(fields, _) => { let mut coord_types: HashSet = HashSet::new(); @@ -917,7 +910,7 @@ fn parse_mixed(field: &Field) -> Result { let coord_type = coord_types.drain().next().unwrap(); let dimension = dimensions.drain().next().unwrap(); - Ok(NativeType::Mixed(coord_type, dimension)) + Ok((coord_type, dimension)) } _ => panic!("Unexpected data type"), } @@ -927,18 +920,10 @@ fn parse_geometry_collection(field: &Field) -> Result { // We need to parse the _inner_ type of the geometry collection as a union so that we can check // what coordinate type it's using. match field.data_type() { - DataType::List(inner_field) => match parse_mixed(inner_field)? { - NativeType::Mixed(coord_type, dim) => { - Ok(NativeType::GeometryCollection(coord_type, dim)) - } - _ => panic!(), - }, - DataType::LargeList(inner_field) => match parse_mixed(inner_field)? { - NativeType::Mixed(coord_type, dim) => { - Ok(NativeType::GeometryCollection(coord_type, dim)) - } - _ => panic!(), - }, + DataType::List(inner_field) | DataType::LargeList(inner_field) => { + let (coord_type, dim) = parse_mixed(inner_field)?; + Ok(NativeType::GeometryCollection(coord_type, dim)) + } _ => panic!(), } } diff --git a/rust/geoarrow/src/io/flatgeobuf/writer.rs b/rust/geoarrow/src/io/flatgeobuf/writer.rs index 1444e707..c9916775 100644 --- a/rust/geoarrow/src/io/flatgeobuf/writer.rs +++ b/rust/geoarrow/src/io/flatgeobuf/writer.rs @@ -159,7 +159,7 @@ fn infer_flatgeobuf_geometry_type(schema: &Schema) -> Result flatgeobuf::GeometryType::MultiPoint, MultiLineString(_, _) => flatgeobuf::GeometryType::MultiLineString, MultiPolygon(_, _) => flatgeobuf::GeometryType::MultiPolygon, - Mixed(_, _) | Rect(_) | Geometry(_) => flatgeobuf::GeometryType::Unknown, + Rect(_) | Geometry(_) => flatgeobuf::GeometryType::Unknown, GeometryCollection(_, _) => flatgeobuf::GeometryType::GeometryCollection, }; Ok(geometry_type) diff --git a/rust/geoarrow/src/io/geozero/array/dynamic.rs b/rust/geoarrow/src/io/geozero/array/dynamic.rs index 28d3c025..9a62d72a 100644 --- a/rust/geoarrow/src/io/geozero/array/dynamic.rs +++ b/rust/geoarrow/src/io/geozero/array/dynamic.rs @@ -27,7 +27,6 @@ impl GeozeroGeometry for NativeArrayDyn { impl_process!(as_multi_line_string) } MultiPolygon(_, _) => impl_process!(as_multi_polygon), - Mixed(_, _) => impl_process!(as_mixed), GeometryCollection(_, _) => { impl_process!(as_geometry_collection) } diff --git a/rust/geoarrow/src/io/geozero/array/mixed.rs b/rust/geoarrow/src/io/geozero/array/mixed.rs index 1d56a0ee..29affcdb 100644 --- a/rust/geoarrow/src/io/geozero/array/mixed.rs +++ b/rust/geoarrow/src/io/geozero/array/mixed.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::array::metadata::ArrayMetadata; -use crate::array::{CoordType, MixedGeometryArray, MixedGeometryBuilder}; +use crate::array::{CoordType, GeometryArray, MixedGeometryArray, MixedGeometryBuilder}; use crate::datatypes::Dimension; use crate::io::geozero::scalar::process_geometry; use crate::trait_::{ArrayAccessor, GeometryArrayBuilder}; @@ -112,8 +112,9 @@ impl MixedGeometryStreamBuilder { self.builder.push_null() } - pub fn finish(self) -> MixedGeometryArray { - self.builder.finish() + pub fn finish(self) -> GeometryArray { + // Hack until the MixedGeometryStreamBuilder is updated to build a GeometryBuilder directly + self.builder.finish().into() } } diff --git a/rust/geoarrow/src/io/geozero/scalar/geometry_array.rs b/rust/geoarrow/src/io/geozero/scalar/geometry_array.rs index b2146ee6..1f75d177 100644 --- a/rust/geoarrow/src/io/geozero/scalar/geometry_array.rs +++ b/rust/geoarrow/src/io/geozero/scalar/geometry_array.rs @@ -44,7 +44,6 @@ pub fn process_geometry_scalar_array( MultiPoint(_, _) => impl_process!(process_multi_point, as_multi_point), MultiLineString(_, _) => impl_process!(process_multi_line_string, as_multi_line_string), MultiPolygon(_, _) => impl_process!(process_multi_polygon, as_multi_polygon), - Mixed(_, _) => impl_process!(process_geometry, as_mixed), GeometryCollection(_, _) => { impl_process!(process_geometry_collection, as_geometry_collection) } diff --git a/rust/geoarrow/src/io/geozero/table/data_source.rs b/rust/geoarrow/src/io/geozero/table/data_source.rs index 76436a05..33508711 100644 --- a/rust/geoarrow/src/io/geozero/table/data_source.rs +++ b/rust/geoarrow/src/io/geozero/table/data_source.rs @@ -393,10 +393,6 @@ fn process_geometry_n( let geom = arr.as_multi_polygon().value(i); process_multi_polygon(&geom, 0, processor)?; } - Mixed(_, _) => { - let geom = arr.as_mixed().value(i); - process_geometry(&geom, 0, processor)?; - } GeometryCollection(_, _) => { let geom = arr.as_geometry_collection().value(i); process_geometry_collection(&geom, 0, processor)?; diff --git a/rust/geoarrow/src/io/parquet/metadata.rs b/rust/geoarrow/src/io/parquet/metadata.rs index 7cc79be3..3e273956 100644 --- a/rust/geoarrow/src/io/parquet/metadata.rs +++ b/rust/geoarrow/src/io/parquet/metadata.rs @@ -181,6 +181,7 @@ impl GeoParquetGeometryType { } } + #[allow(dead_code)] pub(crate) fn has_z(&self) -> bool { match self { Self::Point @@ -196,7 +197,7 @@ impl GeoParquetGeometryType { | Self::MultiPointZ | Self::MultiLineStringZ | Self::MultiPolygonZ - | Self::GeometryCollectionZ => false, + | Self::GeometryCollectionZ => true, } } } @@ -768,11 +769,7 @@ pub(crate) fn infer_geo_data_type( return Ok(Some(NativeType::MultiPolygon(coord_type, Dimension::XYZ))); } - if geometry_types.iter().any(|t| t.has_z()) { - Ok(Some(NativeType::Mixed(coord_type, Dimension::XYZ))) - } else { - Ok(Some(NativeType::Mixed(coord_type, Dimension::XY))) - } + Ok(Some(NativeType::Geometry(coord_type))) } } } diff --git a/rust/geoarrow/src/io/parquet/reader/parse.rs b/rust/geoarrow/src/io/parquet/reader/parse.rs index dd4717b9..7e283258 100644 --- a/rust/geoarrow/src/io/parquet/reader/parse.rs +++ b/rust/geoarrow/src/io/parquet/reader/parse.rs @@ -131,8 +131,10 @@ fn infer_target_wkb_type( geometry_types: &HashSet, coord_type: CoordType, ) -> Result { - Ok(infer_geo_data_type(geometry_types, coord_type)? - .unwrap_or(NativeType::Mixed(coord_type, Dimension::XY))) + Ok( + infer_geo_data_type(geometry_types, coord_type)? + .unwrap_or(NativeType::Geometry(coord_type)), + ) } /// Parse a record batch to a GeoArrow record batch. diff --git a/rust/geoarrow/src/io/parquet/test.rs b/rust/geoarrow/src/io/parquet/test.rs index 7f02eb11..de11269c 100644 --- a/rust/geoarrow/src/io/parquet/test.rs +++ b/rust/geoarrow/src/io/parquet/test.rs @@ -6,9 +6,8 @@ use arrow_array::{BooleanArray, RecordBatch}; use arrow_schema::{Field, Schema}; use bytes::Bytes; -use crate::array::MixedGeometryBuilder; +use crate::array::GeometryBuilder; use crate::chunked_array::ChunkedNativeArrayDyn; -use crate::datatypes::Dimension; use crate::error::Result; use crate::io::parquet::{write_geoparquet, GeoParquetRecordBatchReaderBuilder}; use crate::table::Table; @@ -42,7 +41,7 @@ fn round_trip_nybb() -> Result<()> { // Test from https://github.com/geoarrow/geoarrow-rs/pull/717 #[test] fn mixed_geometry_roundtrip() { - let mut builder = MixedGeometryBuilder::new(Dimension::XY); + let mut builder = GeometryBuilder::new(); builder .push_point(Some(&geo::point!(x: -105., y: 40.))) .unwrap(); diff --git a/rust/geoarrow/src/io/parquet/writer/metadata.rs b/rust/geoarrow/src/io/parquet/writer/metadata.rs index 1b7a99c5..3f6b83af 100644 --- a/rust/geoarrow/src/io/parquet/writer/metadata.rs +++ b/rust/geoarrow/src/io/parquet/writer/metadata.rs @@ -87,34 +87,7 @@ impl ColumnInfo { let array = NativeArrayDyn::from_arrow_array(array, field)?.into_inner(); let array_ref = array.as_ref(); - // We only have to do this for mixed arrays (and unknown below) because other arrays are - // statically known - if let NativeType::Mixed(_, _) = array_ref.data_type() { - let mixed_arr = array_ref.as_mixed(); - if mixed_arr.has_points() { - self.geometry_types.insert(GeoParquetGeometryType::Point); - } - if mixed_arr.has_line_strings() { - self.geometry_types - .insert(GeoParquetGeometryType::LineString); - } - if mixed_arr.has_polygons() { - self.geometry_types.insert(GeoParquetGeometryType::Polygon); - } - if mixed_arr.has_multi_points() { - self.geometry_types - .insert(GeoParquetGeometryType::MultiPoint); - } - if mixed_arr.has_multi_line_strings() { - self.geometry_types - .insert(GeoParquetGeometryType::MultiLineString); - } - if mixed_arr.has_multi_polygons() { - self.geometry_types - .insert(GeoParquetGeometryType::MultiPolygon); - } - } - + // We only have to do this for geometry arrays because other arrays are statically known if let NativeType::Geometry(_) = array_ref.data_type() { let arr = array_ref.as_geometry(); if arr.has_points(Dimension::XY) || arr.has_points(Dimension::XYZ) { @@ -300,7 +273,7 @@ pub fn get_geometry_types(data_type: &NativeType) -> HashSet { geometry_types.insert(MultiPolygonZ); } - NativeType::Mixed(_, _) | NativeType::Geometry(_) => { + NativeType::Geometry(_) => { // We don't have access to the actual data here, so we can't inspect better than this. } NativeType::GeometryCollection(_, Dimension::XY) => { diff --git a/rust/geoarrow/src/io/wkb/api.rs b/rust/geoarrow/src/io/wkb/api.rs index 95e4e0ea..a7691e86 100644 --- a/rust/geoarrow/src/io/wkb/api.rs +++ b/rust/geoarrow/src/io/wkb/api.rs @@ -212,16 +212,6 @@ pub fn from_wkb( MultiPolygonBuilder::from_wkb(&wkb_objects, dim, coord_type, arr.metadata())?; Ok(Arc::new(builder.finish())) } - Mixed(coord_type, dim) => { - let builder = MixedGeometryBuilder::from_wkb( - &wkb_objects, - dim, - coord_type, - arr.metadata(), - prefer_multi, - )?; - Ok(Arc::new(builder.finish())) - } GeometryCollection(coord_type, dim) => { let builder = GeometryCollectionBuilder::from_wkb( &wkb_objects, @@ -268,7 +258,6 @@ impl ToWKB for &dyn NativeArray { MultiPoint(_, _) => self.as_multi_point().into(), MultiLineString(_, _) => self.as_multi_line_string().into(), MultiPolygon(_, _) => self.as_multi_polygon().into(), - Mixed(_, _) => self.as_mixed().into(), GeometryCollection(_, _) => self.as_geometry_collection().into(), Rect(_) => todo!(), @@ -298,7 +287,6 @@ impl ToWKB for &dyn ChunkedNativeArray { MultiPolygon(_, _) => { ChunkedGeometryArray::new(self.as_multi_polygon().map(|chunk| chunk.into())) } - Mixed(_, _) => ChunkedGeometryArray::new(self.as_mixed().map(|chunk| chunk.into())), GeometryCollection(_, _) => { ChunkedGeometryArray::new(self.as_geometry_collection().map(|chunk| chunk.into())) } @@ -319,7 +307,6 @@ pub fn to_wkb(arr: &dyn NativeArray) -> WKBArray { MultiPoint(_, _) => arr.as_multi_point().into(), MultiLineString(_, _) => arr.as_multi_line_string().into(), MultiPolygon(_, _) => arr.as_multi_polygon().into(), - Mixed(_, _) => arr.as_mixed().into(), GeometryCollection(_, _) => arr.as_geometry_collection().into(), Rect(_) => todo!(), Geometry(_) => arr.as_geometry().into(), @@ -350,15 +337,11 @@ mod test { fn point_round_trip() { let arr = point::point_array(); let wkb_arr: WKBArray = to_wkb(&arr); - let roundtrip = from_wkb( - &wkb_arr, - NativeType::Mixed(CoordType::Interleaved, Dimension::XY), - true, - ) - .unwrap(); + let roundtrip = + from_wkb(&wkb_arr, NativeType::Geometry(CoordType::Interleaved), true).unwrap(); let rt_ref = roundtrip.as_ref(); - let rt_mixed_arr = rt_ref.as_mixed(); + let rt_mixed_arr = rt_ref.as_geometry(); let downcasted = rt_mixed_arr.downcast().unwrap(); let downcasted_ref = downcasted.as_ref(); let rt_point_arr = downcasted_ref.as_point(); @@ -371,13 +354,13 @@ mod test { let wkb_arr: WKBArray = to_wkb(&arr); let roundtrip_mixed = from_wkb( &wkb_arr, - NativeType::Mixed(CoordType::Interleaved, Dimension::XYZ), + NativeType::Geometry(CoordType::Interleaved), false, ) .unwrap(); let rt_ref = roundtrip_mixed.as_ref(); - let rt_mixed_arr = rt_ref.as_mixed(); - assert!(rt_mixed_arr.has_points()); + let rt_mixed_arr = rt_ref.as_geometry(); + assert!(rt_mixed_arr.has_points(Dimension::XYZ)); let roundtrip_point = from_wkb( &wkb_arr, diff --git a/rust/geoarrow/src/io/wkt/writer.rs b/rust/geoarrow/src/io/wkt/writer.rs index fa01630d..11dbb4a1 100644 --- a/rust/geoarrow/src/io/wkt/writer.rs +++ b/rust/geoarrow/src/io/wkt/writer.rs @@ -53,7 +53,6 @@ impl ToWKT for &dyn NativeArray { impl_to_wkt!(as_multi_line_string, write_multi_linestring) } MultiPolygon(_, _) => impl_to_wkt!(as_multi_polygon, write_multi_polygon), - Mixed(_, _) => impl_to_wkt!(as_mixed, write_geometry), GeometryCollection(_, _) => { impl_to_wkt!(as_geometry_collection, write_geometry_collection) } @@ -85,7 +84,6 @@ impl ToWKT for &dyn ChunkedNativeArray { MultiPoint(_, _) => impl_to_wkt!(as_multi_point), MultiLineString(_, _) => impl_to_wkt!(as_multi_line_string), MultiPolygon(_, _) => impl_to_wkt!(as_multi_polygon), - Mixed(_, _) => impl_to_wkt!(as_mixed), GeometryCollection(_, _) => impl_to_wkt!(as_geometry_collection), Rect(_) => impl_to_wkt!(as_rect), Geometry(_) => impl_to_wkt!(as_geometry), diff --git a/rust/geoarrow/src/scalar/scalar.rs b/rust/geoarrow/src/scalar/scalar.rs index 16fd0973..5c6c37f3 100644 --- a/rust/geoarrow/src/scalar/scalar.rs +++ b/rust/geoarrow/src/scalar/scalar.rs @@ -1,6 +1,6 @@ use crate::array::{ - AsNativeArray, GeometryArray, GeometryCollectionArray, LineStringArray, MixedGeometryArray, - MultiLineStringArray, MultiPointArray, MultiPolygonArray, PointArray, PolygonArray, RectArray, + AsNativeArray, GeometryArray, GeometryCollectionArray, LineStringArray, MultiLineStringArray, + MultiPointArray, MultiPolygonArray, PointArray, PolygonArray, RectArray, }; use crate::datatypes::{Dimension, NativeType}; use crate::error::{GeoArrowError, Result}; @@ -48,7 +48,6 @@ impl GeometryScalar { | MultiPoint(_, dim) | MultiLineString(_, dim) | MultiPolygon(_, dim) - | Mixed(_, dim) | GeometryCollection(_, dim) | Rect(dim) => dim, Geometry(_) => todo!(), // WKB => { @@ -104,14 +103,6 @@ impl GeometryScalar { let arr = self.0.as_any().downcast_ref::().unwrap(); arr.get(0).map(Geometry::MultiPolygon) } - NativeType::Mixed(_, _) => { - let arr = self - .0 - .as_any() - .downcast_ref::() - .unwrap(); - arr.get(0) - } NativeType::GeometryCollection(_, _) => { let arr = self .0 @@ -147,7 +138,6 @@ impl GeometryScalar { MultiPoint(_, _) => impl_to_geo!(as_multi_point), MultiLineString(_, _) => impl_to_geo!(as_multi_line_string), MultiPolygon(_, _) => impl_to_geo!(as_multi_polygon), - Mixed(_, _) => impl_to_geo!(as_mixed), GeometryCollection(_, _) => impl_to_geo!(as_geometry_collection), Rect(_) => impl_to_geo!(as_rect), Geometry(_) => impl_to_geo!(as_geometry), diff --git a/rust/geoarrow/src/table.rs b/rust/geoarrow/src/table.rs index 75cfd9a0..1b40934e 100644 --- a/rust/geoarrow/src/table.rs +++ b/rust/geoarrow/src/table.rs @@ -12,7 +12,7 @@ use crate::algorithm::native::{Cast, Downcast}; use crate::array::metadata::ArrayMetadata; use crate::array::*; use crate::chunked_array::{ChunkedArray, ChunkedNativeArray, ChunkedNativeArrayDyn}; -use crate::datatypes::{AnyType, Dimension, NativeType, SerializedType}; +use crate::datatypes::{AnyType, NativeType, SerializedType}; use crate::error::{GeoArrowError, Result}; use crate::io::wkb::from_wkb; use crate::schema::GeoSchemaExt; @@ -187,9 +187,8 @@ impl Table { index: usize, target_geo_data_type: Option, ) -> Result { - // TODO: don't always default to XY let target_geo_data_type = - target_geo_data_type.unwrap_or(NativeType::Mixed(Default::default(), Dimension::XY)); + target_geo_data_type.unwrap_or(NativeType::Geometry(Default::default())); let orig_field = self.schema().field(index); let geoarray_metadata = ArrayMetadata::try_from(orig_field)?;