Skip to content

Commit 4052c46

Browse files
committed
Add sedona-geo-traits-ext as a standalone crate
1 parent 46b85ad commit 4052c46

20 files changed

+2893
-2
lines changed

Cargo.lock

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ members = [
2222
"c/sedona-s2geography",
2323
"c/sedona-tg",
2424
"r/sedonadb/src/rust",
25+
# "rust/sedona-geo-traits-ext",
2526
"rust/sedona-adbc",
2627
"rust/sedona-expr",
2728
"rust/sedona-functions",

rust/sedona-geo-traits-ext/Cargo.lock

Lines changed: 271 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
[package]
18+
name = "sedona-geo-traits-ext"
19+
version = "0.2.0"
20+
authors = ["Apache Sedona <[email protected]>"]
21+
license = "Apache-2.0"
22+
homepage = "https://github.com/apache/sedona-db"
23+
repository = "https://github.com/apache/sedona-db"
24+
description = "geo-traits extended for implementing generic algorithms"
25+
readme = "README.md"
26+
edition = "2021"
27+
28+
[workspace]
29+
30+
[dependencies]
31+
geo-traits = { version = "0.3.0", features = ["geo-types"] }
32+
geo-types = "0.7.17"
33+
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
34+
wkb = "0.9.1"
35+
byteorder = "1"
36+
37+
[patch.crates-io]
38+
wkb = { git = "https://github.com/georust/wkb.git", rev = "130eb0c2b343bc9299aeafba6d34c2a6e53f3b6a" }
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing,
12+
software distributed under the License is distributed on an
13+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
KIND, either express or implied. See the License for the
15+
specific language governing permissions and limitations
16+
under the License. -->
17+
18+
# Geo-Traits Extended
19+
20+
This crate extends the `geo-traits` crate with additional traits and
21+
implementations. The goal is to provide a set of traits that are useful for
22+
implementing algorithms in `geo-generic-alg` crate. Most of the methods are
23+
inspired by the `geo-types` crate, but are implemented as traits for the
24+
`geo-traits` types. Some methods returns concrete types defined in `geo-types`,
25+
these methods are only for computing tiny, intermediate results during
26+
algorithm execution. By adding methods in `geo-types` to `geo-traits-ext`,
27+
we can port algorithms in `geo` crate for concrete `geo-types` types to generic
28+
`geo-traits-ext` types more easily.
29+
30+
`geo-traits-ext` traits also has an associated `Tag` type to workaround the
31+
single orphan rule in Rust. For instance, we cannot write blanket `AreaTrait`
32+
implementations for both `LineStringTrait` and `PolygonTrait` because we
33+
cannot show that there would be no type implementing both `LineStringTrait` and
34+
`PolygonTrait`. By adding an associated `Tag` type, we can write blanket
35+
implementations for `AreaTrait<LineStringTag>` and `AreaTrait<PolygonTag>`, since
36+
`AreaTrait<LineStringTag>` and `AreaTrait<PolygonTag>` are different types.
37+
Please refer to the source code of `geo-generic-alg` for more details.

0 commit comments

Comments
 (0)