Skip to content

Commit

Permalink
Remove EWKB-specific function (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Dec 3, 2024
1 parent e478dbb commit 13fc25d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 220 deletions.
14 changes: 8 additions & 6 deletions python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion python/docs/api/core/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Interoperability with other Python geospatial libraries (Shapely, GeoPandas) and
- "!^_"
members:
- read_pyogrio
- from_ewkb
- from_geopandas
- from_shapely
- from_wkb
Expand Down
14 changes: 2 additions & 12 deletions python/geoarrow-core/python/geoarrow/rust/core/_rust.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,6 @@ def read_pyogrio(
Table
"""

def from_ewkb(input: ArrowArrayExportable) -> NativeArray:
"""
Parse an Arrow BinaryArray from EWKB to its GeoArrow-native counterpart.
Args:
input: An Arrow array of Binary type holding EWKB-formatted geometries.
Returns:
A GeoArrow-native geometry array
"""

def from_geopandas(input: gpd.GeoDataFrame) -> Table:
"""
Create a GeoArrow Table from a [GeoPandas GeoDataFrame][geopandas.GeoDataFrame].
Expand Down Expand Up @@ -519,7 +508,8 @@ def from_wkb(
"""
Parse an Arrow BinaryArray from WKB to its GeoArrow-native counterpart.
This expects ISO-formatted WKB geometries.
This will handle both ISO and EWKB flavors of WKB. Any embedded SRID in
EWKB-flavored WKB will be ignored.
Args:
input: An Arrow array of Binary type holding WKB-formatted geometries.
Expand Down
39 changes: 0 additions & 39 deletions python/geoarrow-core/src/interop/ewkb.rs

This file was deleted.

1 change: 0 additions & 1 deletion python/geoarrow-core/src/interop/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod ewkb;
pub mod geopandas;
pub mod numpy;
pub mod pyogrio;
Expand Down
1 change: 0 additions & 1 deletion python/geoarrow-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn _rust(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m
)?)?;

m.add_function(wrap_pyfunction!(crate::interop::ewkb::from_ewkb, m)?)?;
m.add_function(wrap_pyfunction!(
crate::interop::shapely::from_shapely::from_shapely,
m
Expand Down
10 changes: 10 additions & 0 deletions python/tests/interop/test_wkb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ def test_geometry_collection():
assert retour_shapely.geoms[0].geoms[0] == point
assert retour_shapely.geoms[1].geoms[0] == point2
assert retour_shapely.geoms[2].geoms[0] == line_string


def test_ewkb_srid():
geoms = shapely.points([0, 1, 2, 3], [4, 5, 6, 7])
geoms = shapely.set_srid(geoms, 4326)
assert shapely.get_srid(geoms)[0] == 4326

ewkb_array = pa.array(shapely.to_wkb(geoms, flavor="extended", include_srid=True))
retour = to_shapely(from_wkb(ewkb_array))
assert all(geoms == retour)
155 changes: 0 additions & 155 deletions rust/geoarrow/src/io/geozero/api/ewkb.rs

This file was deleted.

2 changes: 0 additions & 2 deletions rust/geoarrow/src/io/geozero/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
mod ewkb;
mod wkt;

pub use ewkb::FromEWKB;
pub use wkt::FromWKT;
2 changes: 1 addition & 1 deletion rust/geoarrow/src/io/geozero/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub(crate) mod array;
mod scalar;
pub(crate) mod table;

pub use api::{FromEWKB, FromWKT};
pub use api::FromWKT;
pub use array::{
ToLineStringArray, ToMixedArray, ToMultiLineStringArray, ToMultiPointArray,
ToMultiPolygonArray, ToPointArray, ToPolygonArray,
Expand Down
8 changes: 6 additions & 2 deletions rust/geoarrow/src/io/wkb/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use crate::trait_::ArrayAccessor;
use crate::NativeArray;
use arrow_array::OffsetSizeTrait;

/// An optimized implementation of converting from ISO WKB-encoded geometries.
/// An optimized implementation of converting from WKB-encoded geometries.
///
/// This supports either ISO or EWKB-flavored data.
///
/// This implementation performs a two-pass approach, first scanning the input geometries to
/// determine the exact buffer sizes, then making a single set of allocations and filling those new
Expand Down Expand Up @@ -176,7 +178,9 @@ impl FromWKB for Arc<dyn ChunkedNativeArray> {
}
}

/// Parse an ISO [WKBArray] to a GeometryArray with GeoArrow native encoding.
/// Parse a [WKBArray] to a GeometryArray with GeoArrow native encoding.
///
/// This supports either ISO or EWKB-flavored data.
///
/// Does not downcast automatically
pub fn from_wkb<O: OffsetSizeTrait>(
Expand Down

0 comments on commit 13fc25d

Please sign in to comment.