Skip to content

Commit

Permalink
Merge branch 'main' into kyle/flatgeobuf-iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Dec 23, 2024
2 parents 43d4bf5 + 676a09a commit cf1f35f
Show file tree
Hide file tree
Showing 105 changed files with 1,126 additions and 589 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ jobs:
# - uses: actions/checkout@v4
# with:
# submodules: "recursive"
# # We use nightly for now so that we can pass RUSTFLAGS below to work around
# # https://github.com/geoarrow/geoarrow-rs/issues/716
# - uses: dtolnay/rust-toolchain@nightly
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - uses: prefix-dev/[email protected]
# with:
Expand All @@ -118,6 +116,6 @@ jobs:
# echo "PKG_CONFIG_PATH=$(pwd)/build/.pixi/envs/default/lib/pkgconfig" >> "$GITHUB_ENV"
# echo "LD_LIBRARY_PATH=$(pwd)/build/.pixi/envs/default/lib" >> "$GITHUB_ENV"
# - name: Build benchmarks with no features
# run: RUSTFLAGS="-Zinline-mir=no" cargo bench --no-run
# run: cargo bench --no-run
# - name: Build benchmarks with all features
# run: RUSTFLAGS="-Zinline-mir=no" cargo bench --no-run --all-features
# run: cargo bench --no-run --all-features
13 changes: 0 additions & 13 deletions .github/workflows/python-core-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ jobs:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
Expand Down Expand Up @@ -83,8 +80,6 @@ jobs:
# python-version: 3.x
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# env:
# RUSTFLAGS: "-Zinline-mir=no"
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 --manifest-path python/${{ matrix.module }}/Cargo.toml
Expand Down Expand Up @@ -116,10 +111,7 @@ jobs:
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
Expand Down Expand Up @@ -149,10 +141,7 @@ jobs:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 --manifest-path python/${{ matrix.module }}/Cargo.toml
sccache: "true"
Expand Down Expand Up @@ -191,8 +180,6 @@ jobs:
- run: pip install pyodide-build
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/python-io-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ jobs:

- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
# As of Nov 2024, it was necessary to manually specify -i 3.13 to get
# maturin to find the executable. --find-interpreter did not find it.
Expand Down Expand Up @@ -88,10 +85,7 @@ jobs:

- name: Build wheels - ${{ matrix.platform.target }}
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -m python/geoarrow-io/Cargo.toml
sccache: "true"
Expand Down Expand Up @@ -124,10 +118,7 @@ jobs:

- name: Build wheels
uses: PyO3/maturin-action@v1
env:
RUSTFLAGS: "-Zinline-mir=no"
with:
rust-toolchain: nightly
target: ${{ matrix.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -m python/geoarrow-io/Cargo.toml

Expand Down Expand Up @@ -162,10 +153,8 @@ jobs:
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# rust-toolchain: nightly
# target: ${{ matrix.target }}
# manylinux: musllinux_1_2
# TODO: update rustflags env
# args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -m python/geoarrow-io/Cargo.toml

# - name: Install built wheel
Expand Down Expand Up @@ -206,10 +195,8 @@ jobs:
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# rust-toolchain: nightly
# target: ${{ matrix.platform.target }}
# manylinux: musllinux_1_2
# TODO: update rustflags env
# args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -m python/geoarrow-io/Cargo.toml

# - uses: uraimo/[email protected]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- `GeometryArrayRef` renamed to `NativeArrayRef`.
- `GeometryArrayTrait` renamed to `NativeScalar`.
- `GeometryArrayDyn` renamed to `NativeArrayDyn`.
- `GeometryArrayAccessor` renamed to `ArrayAccessor`.
- `AsGeometryArray` renamed to `AsNativeArray`.
- `AsChunkedGeometryArray` renamed to `AsChunkedNativeArray`.
- `ChunkedGeometryArrayTrait` renamed to `ChunkedNativeArray`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

34 changes: 17 additions & 17 deletions js/src/algorithm/geo/skew.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::broadcasting::BroadcastableFloat;
use crate::data::*;
use crate::scalar::Point;
// use crate::scalar::Point;
use wasm_bindgen::prelude::*;

macro_rules! impl_skew {
Expand Down Expand Up @@ -28,22 +28,22 @@ macro_rules! impl_skew {
Skew::skew_xy(&self.0, &degrees_x.0, &degrees_y.0).into()
}

/// An affine transformation which skews a geometry around a point of `origin`, sheared
/// by an angle along the x and y dimensions.
///
/// The point of origin is *usually* given as the 2D bounding box centre of the
/// geometry, in which case you can just use [`skew`](Self::skew) or
/// [`skew_xy`](Self::skew_xy), but this method allows you to specify any point.
#[wasm_bindgen(js_name = skewAroundPoint)]
pub fn skew_around_point(
&self,
degrees_x: BroadcastableFloat,
degrees_y: BroadcastableFloat,
origin: Point,
) -> Self {
use geoarrow::algorithm::geo::Skew;
Skew::skew_around_point(&self.0, &degrees_x.0, &degrees_y.0, origin.0.into()).into()
}
// /// An affine transformation which skews a geometry around a point of `origin`, sheared
// /// by an angle along the x and y dimensions.
// ///
// /// The point of origin is *usually* given as the 2D bounding box centre of the
// /// geometry, in which case you can just use [`skew`](Self::skew) or
// /// [`skew_xy`](Self::skew_xy), but this method allows you to specify any point.
// #[wasm_bindgen(js_name = skewAroundPoint)]
// pub fn skew_around_point(
// &self,
// degrees_x: BroadcastableFloat,
// degrees_y: BroadcastableFloat,
// origin: Point,
// ) -> Self {
// use geoarrow::algorithm::geo::Skew;
// Skew::skew_around_point(&self.0, &degrees_x.0, &degrees_y.0, origin.0.into()).into()
// }
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub mod ffi;
pub mod io;
// #[cfg(feature = "geodesy")]
// pub mod reproject;
#[cfg(feature = "scalar")]
pub mod scalar;
// #[cfg(feature = "scalar")]
// pub mod scalar;
#[cfg(feature = "vector")]
pub mod vector;
// pub mod transform_origin;
Expand Down
8 changes: 2 additions & 6 deletions python/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,17 @@ PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
source ~/github/emscripten-core/emsdk/emsdk_env.sh
```

Note that the addition of `RUSTFLAGS="-Zinline-mir=no"` is temporary due to https://github.com/rust-lang/rust/issues/128887.

Build `geoarrow-rust-core` and `geoarrow-rust-io`:

```bash
RUSTFLAGS="-Zinline-mir=no" RUSTUP_TOOLCHAIN=nightly \
maturin build \
maturin build \
--release \
--no-default-features \
-o dist \
-m geoarrow-core/Cargo.toml \
--target wasm32-unknown-emscripten \
-i python3.11
RUSTFLAGS="-Zinline-mir=no" RUSTUP_TOOLCHAIN=nightly \
maturin build \
maturin build \
--release \
--no-default-features \
-o dist \
Expand Down
6 changes: 1 addition & 5 deletions python/geoarrow-core/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ source emsdk_env.sh
cd ..
```

- The `RUSTFLAGS` is temporary to get around this compiler bug.
- You must use rust nightly
- You must use `--no-default-features` to remove any async support. `tokio` does not compile for emscripten.

```bash
RUSTFLAGS='-Zinline-mir=no' /
RUSTUP_TOOLCHAIN=nightly /
maturin build /
maturin build /
--no-default-features /
--release /
-o dist /
Expand Down
7 changes: 3 additions & 4 deletions python/tests/interop/test_wkb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ def test_geometry_collection():
retour = to_wkb(parsed_geoarrow)
retour_shapely = shapely.from_wkb(retour[0].as_py())

# Need to unpack the geoms because they're returned as multi-geoms
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
assert retour_shapely.geoms[0] == point
assert retour_shapely.geoms[1] == point2
assert retour_shapely.geoms[2] == line_string


def test_ewkb_srid():
Expand Down
2 changes: 1 addition & 1 deletion rust/geoarrow/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[package]
name = "geoarrow"
version = "0.4.0-beta.2"
version = "0.4.0-beta.3"
authors = ["Kyle Barron <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
6 changes: 3 additions & 3 deletions rust/geoarrow/src/algorithm/geo/contains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use crate::algorithm::native::{Binary, Unary};
use crate::array::*;
use crate::datatypes::NativeType;
use crate::error::GeoArrowError;
use crate::io::geo::geometry_to_geo;
use crate::trait_::NativeScalar;
use crate::NativeArray;
use arrow_array::BooleanArray;
use geo::Contains as _Contains;
use geo_traits::to_geo::*;
use geo_traits::GeometryTrait;

/// Checks if `rhs` is completely contained within `self`.
Expand Down Expand Up @@ -135,7 +135,7 @@ pub trait ContainsGeometry<Rhs> {

impl<G: GeometryTrait<T = f64>> ContainsGeometry<G> for PointArray {
fn contains(&self, rhs: &G) -> BooleanArray {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.try_unary_boolean::<_, GeoArrowError>(|geom| Ok(geom.to_geo().contains(&rhs)))
.unwrap()
}
Expand All @@ -145,7 +145,7 @@ macro_rules! impl_contains_point {
($array:ty) => {
impl<G: GeometryTrait<T = f64>> ContainsGeometry<G> for $array {
fn contains(&self, rhs: &G) -> BooleanArray {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.try_unary_boolean::<_, GeoArrowError>(|geom| {
Ok(geom.to_geo_geometry().contains(&rhs))
})
Expand Down
17 changes: 9 additions & 8 deletions rust/geoarrow/src/algorithm/geo/intersects.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::chunked_array::ChunkedArray;
use crate::indexed::array::*;
use crate::indexed::chunked::*;
use crate::io::geo::{geometry_collection_to_geo, geometry_to_geo};
use crate::trait_::NativeScalar;
use arrow_array::BooleanArray;
use geo::{BoundingRect, Intersects as _Intersects};
Expand Down Expand Up @@ -592,7 +593,7 @@ impl<G: GeometryTrait<T = f64>> IntersectsGeometry<G> for IndexedPointArray {
type Output = BooleanArray;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.unary_boolean(&rhs.bounding_rect().unwrap(), |geom| {
geom.to_geo().intersects(&rhs)
})
Expand All @@ -605,7 +606,7 @@ macro_rules! impl_intersects {
type Output = BooleanArray;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.unary_boolean(&rhs.bounding_rect().unwrap(), |geom| {
geom.to_geo().intersects(&rhs)
})
Expand All @@ -626,7 +627,7 @@ impl<G: GeometryTrait<T = f64>> IntersectsGeometry<G> for IndexedChunkedPointArr
type Output = ChunkedArray<BooleanArray>;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.map(|chunk| IntersectsGeometry::intersects(chunk, &rhs))
.try_into()
.unwrap()
Expand All @@ -639,7 +640,7 @@ macro_rules! impl_intersects {
type Output = ChunkedArray<BooleanArray>;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry();
let rhs = geometry_to_geo(rhs);
self.map(|chunk| IntersectsGeometry::intersects(chunk, &rhs))
.try_into()
.unwrap()
Expand All @@ -666,7 +667,7 @@ impl<G: GeometryCollectionTrait<T = f64>> IntersectsGeometryCollection<G> for In
type Output = BooleanArray;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry_collection();
let rhs = geometry_collection_to_geo(rhs);
self.unary_boolean(&rhs.bounding_rect().unwrap(), |geom| {
geom.to_geo().intersects(&rhs)
})
Expand All @@ -679,7 +680,7 @@ macro_rules! impl_intersects {
type Output = BooleanArray;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry_collection();
let rhs = geometry_collection_to_geo(rhs);
self.unary_boolean(&rhs.bounding_rect().unwrap(), |geom| {
geom.to_geo().intersects(&rhs)
})
Expand All @@ -702,7 +703,7 @@ impl<G: GeometryCollectionTrait<T = f64>> IntersectsGeometryCollection<G>
type Output = ChunkedArray<BooleanArray>;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry_collection();
let rhs = geometry_collection_to_geo(rhs);
self.map(|chunk| IntersectsGeometryCollection::intersects(chunk, &rhs))
.try_into()
.unwrap()
Expand All @@ -715,7 +716,7 @@ macro_rules! impl_intersects {
type Output = ChunkedArray<BooleanArray>;

fn intersects(&self, rhs: &G) -> Self::Output {
let rhs = rhs.to_geometry_collection();
let rhs = geometry_collection_to_geo(rhs);
self.map(|chunk| IntersectsGeometryCollection::intersects(chunk, &rhs))
.try_into()
.unwrap()
Expand Down
Loading

0 comments on commit cf1f35f

Please sign in to comment.