Skip to content

Commit 0c31ce7

Browse files
authored
python: bump to 0.1.0 (#403)
1 parent 6e51bc8 commit 0c31ce7

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

python/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
tmp*.py
2+
tmp*.ts
3+
tmp*.js
14
*.zip
25
site
36
/target

python/core/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "geoarrow-rust"
3-
version = "0.1.0-beta.4"
3+
version = "0.1.0"
44
authors = ["Kyle Barron <kylebarron2@gmail.com>"]
55
edition = "2021"
66
description = "Efficient, vectorized geospatial operations in Python."

python/core/src/algorithm/geo/geodesic_length.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
use crate::array::*;
2+
use crate::chunked_array::*;
3+
use crate::error::PyGeoArrowResult;
4+
use geoarrow::algorithm::geo::GeodesicLength;
25
use pyo3::prelude::*;
36

47
macro_rules! impl_geodesic_length {
@@ -13,7 +16,6 @@ macro_rules! impl_geodesic_length {
1316
///
1417
/// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf
1518
pub fn geodesic_length(&self) -> Float64Array {
16-
use geoarrow::algorithm::geo::GeodesicLength;
1719
GeodesicLength::geodesic_length(&self.0).into()
1820
}
1921
}
@@ -24,3 +26,26 @@ impl_geodesic_length!(PointArray);
2426
impl_geodesic_length!(MultiPointArray);
2527
impl_geodesic_length!(LineStringArray);
2628
impl_geodesic_length!(MultiLineStringArray);
29+
30+
macro_rules! impl_chunked {
31+
($struct_name:ident) => {
32+
#[pymethods]
33+
impl $struct_name {
34+
/// Determine the length of a geometry on an ellipsoidal model of the earth.
35+
///
36+
/// This uses the geodesic measurement methods given by [Karney (2013)]. As opposed to
37+
/// older methods like Vincenty, this method is accurate to a few nanometers and always
38+
/// converges.
39+
///
40+
/// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf
41+
pub fn geodesic_length(&self) -> PyGeoArrowResult<ChunkedFloat64Array> {
42+
Ok(GeodesicLength::geodesic_length(&self.0)?.into())
43+
}
44+
}
45+
};
46+
}
47+
48+
impl_chunked!(ChunkedPointArray);
49+
impl_chunked!(ChunkedMultiPointArray);
50+
impl_chunked!(ChunkedLineStringArray);
51+
impl_chunked!(ChunkedMultiLineStringArray);

0 commit comments

Comments
 (0)