Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customizable GeodesicMeasure #1311

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
matrix:
container_image:
# Use the latest stable version. No need for older versions.
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -78,10 +78,10 @@ jobs:
# giving us about 6 months of coverage.
#
# Minimum supported rust version (MSRV)
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.75"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.80"
# Two most recent releases - we omit older ones for expedient CI
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.82"
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.84"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -106,10 +106,10 @@ jobs:
# giving us about 6 months of coverage.
#
# Minimum supported rust version (MSRV)
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.75"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.80"
# Two most recent releases - we omit older ones for expedient CI
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.82"
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.84"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -133,10 +133,10 @@ jobs:
# giving us about 6 months of coverage.
#
# Minimum supported rust version (MSRV)
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.75"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.80"
# Two most recent releases - we omit older ones for expedient CI
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.82"
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.84"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -159,10 +159,10 @@ jobs:
# giving us about 6 months of coverage.
#
# Minimum supported rust version (MSRV)
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.75"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.80"
# Two most recent releases - we omit older ones for expedient CI
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.82"
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.84"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -182,7 +182,7 @@ jobs:
matrix:
container_image:
# Fuzz only on latest
- "ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83"
- "ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83"
container:
image: ${{ matrix.container_image }}
steps:
Expand All @@ -195,7 +195,7 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
container:
image: ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83
image: ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -206,7 +206,7 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
container:
image: ghcr.io/georust/geo-ci:proj-9.4.0-rust-1.83
image: ghcr.io/georust/geo-ci:proj-9.5.0-rust-1.83
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
17 changes: 16 additions & 1 deletion geo/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Euclidean.densify(&line_string)
Haversine.densify(&line_string)
```
- Add configurable `HaversineMeasure` for doing calculations on a custom sphere. Use `Haversine` for the default earth radius.
- Add configurable `HaversineMeasure` for doing calculations on a custom sphere. Use the `Haversine` instance for the default Earth radius.
- <https://github.com/georust/geo/pull/1298>
```rust
// before
Expand All @@ -27,6 +27,19 @@
// For custom earth (or non-earth!) radius
HaversineMeasure::new(3_389_500.0).distance(point1, point2)
```
- Add configurable `GeodesiceMeasure` for doing calculations on a custom geoid. Use the `Geodesic` instance for the default Earth geoid.
- <https://github.com/georust/geo/pull/1311>
```rust
// before
Geodesic::distance(point1, point2)

// after
Geodesic.distance(point1, point2)

// For custom Earth (or non-earth!) geoids:
let nad83_flattening = 1. / 298.257222101;
GeodesicMeasure::new(6_378_137, nad83_flattening).distance(point1, point2)
```
- Rename `triangulate_spade` and `TriangulateSpade` to `triangulate_delaunay` and `TriangulateDelaunay`
- Docs: Fix page location of citation for mean earth radius used in Haversine calculations
- <https://github.com/georust/geo/pull/1297>
Expand Down Expand Up @@ -54,6 +67,8 @@
- <https://github.com/georust/geo/pull/1310>
- Update `i_overlay`, which is used by the `BoolOps` trait.
- <https://github.com/georust/geo/pull/1314>
- Bump `geo` MSRV to 1.80 and update CI
- <https://github.com/georust/geo/pull/1311>

## 0.29.3 - 2024.12.03

Expand Down
2 changes: 1 addition & 1 deletion geo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "../README.md"
keywords = ["gis", "geo", "geography", "geospatial"]
autobenches = true
edition = "2021"
rust-version = "1.75"
rust-version = "1.80"
categories = ["science::geo"]

[features]
Expand Down
4 changes: 2 additions & 2 deletions geo/src/algorithm/line_measures/densify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use num_traits::FromPrimitive;
/// assert_relative_eq!(densified, expected_output);
///```
///
/// For lng/lat geometries, consider using a different [metric space] like [`Haversine`](crate::HaversineMeasure) or [`Geodesic`](crate::Geodesic).
/// For lng/lat geometries, consider using a different [metric space] like [`Haversine`](crate::Haversine) or [`Geodesic`](crate::Geodesic).
///
///```
/// # use approx::assert_relative_eq;
Expand Down Expand Up @@ -101,7 +101,7 @@ where
/// assert_relative_eq!(densified, expected_output);
///```
///
/// For lng/lat geometries, consider using a different [metric space] like [`Haversine`](crate::HaversineMeasure) or [`Geodesic`](crate::Geodesic).
/// For lng/lat geometries, consider using a different [metric space] like [`Haversine`](crate::Haversine) or [`Geodesic`](crate::Geodesic).
///
///```
/// # use approx::assert_relative_eq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<F: CoordFloat> Distance<F, Point<F>, Point<F>> for Euclidean {
/// );
/// ```
///
/// [`Haversine`]: crate::line_measures::metric_spaces::HaversineMeasure
/// [`Haversine`]: crate::line_measures::metric_spaces::Haversine
/// [`Geodesic`]: crate::line_measures::metric_spaces::Geodesic
/// [metric spaces]: crate::line_measures::metric_spaces
fn distance(&self, origin: Point<F>, destination: Point<F>) -> F {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use num_traits::FromPrimitive;
///
/// [Euclidean plane]: https://en.wikipedia.org/wiki/Euclidean_plane
/// [`Transform`]: crate::Transform
/// [`Haversine`]: super::HaversineMeasure
/// [`Haversine`]: super::Haversine
/// [`Geodesic`]: super::Geodesic
/// [metric spaces]: super
pub struct Euclidean;
Expand All @@ -35,7 +35,7 @@ impl<F: CoordFloat + FromPrimitive> InterpolatePoint<F> for Euclidean {
/// units, like meters or miles, **not** lon/lat.
/// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces].
///
/// [`Haversine`]: crate::line_measures::HaversineMeasure
/// [`Haversine`]: crate::line_measures::Haversine
/// [`Geodesic`]: crate::line_measures::Geodesic
/// [metric spaces]: crate::line_measures::metric_spaces
fn point_at_distance_between(
Expand All @@ -59,7 +59,7 @@ impl<F: CoordFloat + FromPrimitive> InterpolatePoint<F> for Euclidean {
/// units, like meters or miles, **not** lon/lat.
/// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces].
///
/// [`Haversine`]: crate::line_measures::HaversineMeasure
/// [`Haversine`]: crate::line_measures::Haversine
/// [`Geodesic`]: crate::line_measures::Geodesic
/// [metric spaces]: crate::line_measures::metric_spaces
fn point_at_ratio_between(
Expand Down Expand Up @@ -87,7 +87,7 @@ impl<F: CoordFloat + FromPrimitive> InterpolatePoint<F> for Euclidean {
/// units, like meters or miles, **not** lon/lat.
/// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces].
///
/// [`Haversine`]: crate::line_measures::HaversineMeasure
/// [`Haversine`]: crate::line_measures::Haversine
/// [`Geodesic`]: crate::line_measures::Geodesic
/// [metric spaces]: crate::line_measures::metric_spaces
fn points_along_line(
Expand Down
Loading