Skip to content

Commit

Permalink
python: bump to 0.1.0 (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Jan 8, 2024
1 parent 6e51bc8 commit 0c31ce7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 3 additions & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
tmp*.py
tmp*.ts
tmp*.js
*.zip
site
/target
Expand Down
2 changes: 1 addition & 1 deletion python/core/Cargo.lock

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

2 changes: 1 addition & 1 deletion python/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geoarrow-rust"
version = "0.1.0-beta.4"
version = "0.1.0"
authors = ["Kyle Barron <[email protected]>"]
edition = "2021"
description = "Efficient, vectorized geospatial operations in Python."
Expand Down
27 changes: 26 additions & 1 deletion python/core/src/algorithm/geo/geodesic_length.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::array::*;
use crate::chunked_array::*;
use crate::error::PyGeoArrowResult;
use geoarrow::algorithm::geo::GeodesicLength;
use pyo3::prelude::*;

macro_rules! impl_geodesic_length {
Expand All @@ -13,7 +16,6 @@ macro_rules! impl_geodesic_length {
///
/// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf
pub fn geodesic_length(&self) -> Float64Array {
use geoarrow::algorithm::geo::GeodesicLength;
GeodesicLength::geodesic_length(&self.0).into()
}
}
Expand All @@ -24,3 +26,26 @@ impl_geodesic_length!(PointArray);
impl_geodesic_length!(MultiPointArray);
impl_geodesic_length!(LineStringArray);
impl_geodesic_length!(MultiLineStringArray);

macro_rules! impl_chunked {
($struct_name:ident) => {
#[pymethods]
impl $struct_name {
/// Determine the length of a geometry on an ellipsoidal model of the earth.
///
/// This uses the geodesic measurement methods given by [Karney (2013)]. As opposed to
/// older methods like Vincenty, this method is accurate to a few nanometers and always
/// converges.
///
/// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf
pub fn geodesic_length(&self) -> PyGeoArrowResult<ChunkedFloat64Array> {
Ok(GeodesicLength::geodesic_length(&self.0)?.into())
}
}
};
}

impl_chunked!(ChunkedPointArray);
impl_chunked!(ChunkedMultiPointArray);
impl_chunked!(ChunkedLineStringArray);
impl_chunked!(ChunkedMultiLineStringArray);

0 comments on commit 0c31ce7

Please sign in to comment.