Skip to content

Commit

Permalink
Bump wkt and wkb deps (#878)
Browse files Browse the repository at this point in the history
Closes #857
  • Loading branch information
kylebarron authored Nov 27, 2024
1 parent 91a22cc commit 020b8bf
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 90 deletions.
68 changes: 34 additions & 34 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions rust/geoarrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ rayon = ["dep:rayon"]


[dependencies]
arrow = { version = "53", features = ["ffi"] }
arrow-array = { version = "53", features = ["chrono-tz"] }
arrow-buffer = "53"
arrow-cast = { version = "53" }
arrow-data = "53"
arrow-ipc = "53"
arrow-schema = "53"
arrow = { version = "53.3", features = ["ffi"] }
arrow-array = { version = "53.3", features = ["chrono-tz"] }
arrow-buffer = "53.3"
arrow-cast = { version = "53.3" }
arrow-data = "53.3"
arrow-ipc = "53.3"
arrow-schema = "53.3"
async-stream = { version = "0.3", optional = true }
async-trait = { version = "0.1", optional = true }
bytes = { version = "1.5.0", optional = true }
Expand Down Expand Up @@ -97,8 +97,8 @@ sqlx = { version = "0.7", optional = true, default-features = false, features =
thiserror = "1"
tokio = { version = "1", default-features = false, optional = true }
# wkt = "0.11"
wkt = { git = "https://github.com/georust/wkt", rev = "447be533e0a76188ca499eb8a0c74fc4e8a0f823" }
wkb = { git = "https://github.com/kylebarron/wkb", rev = "e0f29b4a24104356464cc123925b459d81c40e52" }
wkt = { git = "https://github.com/georust/wkt", rev = "94c32cdbdaf9523b3d71cd4b2d5d3a033efadacb" }
wkb = { git = "https://github.com/kylebarron/wkb", rev = "51a95fff591c7e66ea10f6effaba0d48b3b0a392" }


[dev-dependencies]
Expand Down
48 changes: 16 additions & 32 deletions rust/geoarrow/src/array/binary/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use geo_traits::{
MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait,
};
use wkb::writer::{
geometry_collection_wkb_size, line_string_wkb_size, multi_line_string_wkb_size,
multi_point_wkb_size, multi_polygon_wkb_size, point_wkb_size, polygon_wkb_size,
write_geometry_collection, write_line_string, write_multi_line_string, write_multi_point,
write_multi_polygon, write_point, write_polygon,
};
Expand Down Expand Up @@ -59,13 +57,13 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
}

pub fn with_capacity_from_iter<'a>(
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait + 'a)>>,
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>,
) -> Self {
Self::with_capacity_and_options_from_iter(geoms, Default::default())
}

pub fn with_capacity_and_options_from_iter<'a>(
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait + 'a)>>,
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>,
metadata: Arc<ArrayMetadata>,
) -> Self {
let counter = WKBCapacity::from_geometries(geoms);
Expand All @@ -81,10 +79,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_point(&mut self, geom: Option<&impl PointTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(point_wkb_size(geom.dim()));
write_point(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_point(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null();
}
Expand All @@ -94,10 +90,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_line_string(&mut self, geom: Option<&impl LineStringTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(line_string_wkb_size(geom));
write_line_string(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_line_string(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand All @@ -107,10 +101,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_polygon(&mut self, geom: Option<&impl PolygonTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(polygon_wkb_size(geom));
write_polygon(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_polygon(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand All @@ -120,10 +112,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_multi_point(&mut self, geom: Option<&impl MultiPointTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_point_wkb_size(geom));
write_multi_point(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_multi_point(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand All @@ -133,10 +123,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_multi_line_string(&mut self, geom: Option<&impl MultiLineStringTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_line_string_wkb_size(geom));
write_multi_line_string(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_multi_line_string(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand All @@ -146,10 +134,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
#[inline]
pub fn push_multi_polygon(&mut self, geom: Option<&impl MultiPolygonTrait<T = f64>>) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_polygon_wkb_size(geom));
write_multi_polygon(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_multi_polygon(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand Down Expand Up @@ -188,10 +174,8 @@ impl<O: OffsetSizeTrait> WKBBuilder<O> {
geom: Option<&impl GeometryCollectionTrait<T = f64>>,
) {
if let Some(geom) = geom {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(geometry_collection_wkb_size(geom));
write_geometry_collection(&mut buf, geom, Endianness::LittleEndian).unwrap();
self.0.append_value(&buf)
write_geometry_collection(&mut self.0, geom, Endianness::LittleEndian).unwrap();
self.0.append_value("")
} else {
self.0.append_null()
}
Expand Down
Loading

0 comments on commit 020b8bf

Please sign in to comment.