Skip to content

Commit f6e559a

Browse files
committed
feat(stac): add geoarrow and geoparquet
The were their own crates, but that seemed to be overkill.
1 parent eb1d687 commit f6e559a

23 files changed

+188
-372
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
args:
2323
- "-p stac"
2424
- "-p stac -F reqwest"
25+
- "-p stac -F geoarrow"
26+
- "-p stac -F geoparquet"
2527
- "-p stac-api"
2628
- "-p stac -p stac-api -F geo"
27-
- "-p stac-arrow"
2829
- "-p stac-async"
2930
- "-p stac-cli --no-default-features"
30-
- "-p stac-geoparquet"
3131
- "-p stac-server --no-default-features"
3232
- "-p stac-server --no-default-features -F axum"
3333
- "-p stac-server --no-default-features -F memory-item-search"

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ members = [
55
"pgstac",
66
"python",
77
"stac-api",
8-
"stac-arrow",
98
"stac-async",
109
"stac-cli",
11-
"stac-geoparquet",
1210
"stac-server",
1311
"stac-validate",
1412
]
1513
default-members = [
1614
"python",
1715
"stac",
1816
"stac-api",
19-
"stac-arrow",
2017
"stac-async",
2118
"stac-cli",
22-
"stac-geoparquet",
2319
"stac-server",
2420
"stac-validate",
2521
]

stac-arrow/Cargo.toml

-30
This file was deleted.

stac-arrow/README.md

-35
This file was deleted.

stac-arrow/data

-1
This file was deleted.

stac-cli/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ clap = { version = "4", features = ["derive"] }
2222
reqwest = "0.12"
2323
serde = "1"
2424
serde_json = "1"
25-
stac = { version = "0.8", path = "../stac" }
25+
stac = { version = "0.8", path = "../stac", features = ["geoparquet"] }
2626
stac-api = { version = "0.4", path = "../stac-api" }
2727
stac-async = { version = "0.5", path = "../stac-async" }
28-
stac-geoparquet = { version = "0.0.1", path = "../stac-geoparquet" }
2928
stac-server = { version = "0.1", path = "../stac-server", features = [
3029
"memory-item-search",
3130
"tokio",

stac-cli/src/error.rs

-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ pub enum Error {
3333
#[error(transparent)]
3434
StacAsync(#[from] stac_async::Error),
3535

36-
/// [stac_geoparquet::Error]
37-
#[error(transparent)]
38-
StacGeoparquet(#[from] stac_geoparquet::Error),
39-
4036
/// [stac_server::Error]
4137
#[error(transparent)]
4238
StacServer(#[from] stac_server::Error),

stac-cli/src/format.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ impl Format {
2626
match *self {
2727
Format::Parquet => {
2828
let item_collection = if let Some(url) = stac::href_to_url(href) {
29-
stac_geoparquet::from_reader(reqwest::blocking::get(url)?.bytes()?)?
29+
stac::geoparquet::from_reader(reqwest::blocking::get(url)?.bytes()?)?
3030
} else {
3131
let file = File::open(href)?;
32-
stac_geoparquet::from_reader(file)?
32+
stac::geoparquet::from_reader(file)?
3333
};
3434
serde_json::from_value(serde_json::to_value(item_collection)?)
3535
.map_err(Error::from)
@@ -41,7 +41,7 @@ impl Format {
4141
Format::Parquet => {
4242
let mut buf = Vec::new();
4343
let _ = std::io::stdin().read_to_end(&mut buf)?;
44-
let item_collection = stac_geoparquet::from_reader(Bytes::from(buf))?;
44+
let item_collection = stac::geoparquet::from_reader(Bytes::from(buf))?;
4545
serde_json::from_value(serde_json::to_value(item_collection)?)
4646
.map_err(Error::from)
4747
}

stac-cli/src/runner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ where
4848
}
4949
Format::Parquet => {
5050
if let Some(value) = value.to_stac() {
51-
stac_geoparquet::to_writer(&mut self.writer, value)?;
51+
stac::geoparquet::to_writer(&mut self.writer, value)?;
5252
} else {
5353
writeln!(self.writer, "{}", value)?;
5454
}

stac-geoparquet/Cargo.toml

-34
This file was deleted.

stac-geoparquet/README.md

-52
This file was deleted.

stac-geoparquet/data

-1
This file was deleted.
-34.2 KB
Binary file not shown.

stac/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
- `Bbox` ([#303](https://github.com/stac-utils/stac-rs/pull/303))
1212
- Functions to create collections from items ([#304](https://github.com/stac-utils/stac-rs/pull/304))
1313
- Default implementation for `Version` ([#309](https://github.com/stac-utils/stac-rs/pull/309))
14+
- Experimental GeoParquet and GeoArrow support ([#316](https://github.com/stac-utils/stac-rs/pull/316))
1415

1516
### Changed
1617

stac/Cargo.toml

+25
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,39 @@ categories = ["science", "data-structures"]
1313
[features]
1414
gdal = ["dep:gdal", "dep:gdal-sys"]
1515
geo = ["dep:geo"]
16+
geoarrow = [
17+
"dep:geoarrow",
18+
"dep:arrow-array",
19+
"dep:arrow-cast",
20+
"dep:arrow-json",
21+
"dep:arrow-schema",
22+
"dep:geo-types",
23+
]
24+
geoparquet = ["geoarrow/parquet", "dep:parquet"]
25+
geoparquet-compression = [
26+
"geoarrow/parquet_compression",
27+
"parquet/snap",
28+
"parquet/brotli",
29+
"parquet/flate2",
30+
"parquet/lz4",
31+
"parquet/zstd",
32+
]
1633
reqwest = ["dep:reqwest"]
1734

1835
[dependencies]
36+
arrow-array = { version = "52", optional = true }
37+
arrow-cast = { version = "52", optional = true }
38+
arrow-json = { version = "52", optional = true }
39+
arrow-schema = { version = "52", optional = true }
1940
chrono = { version = "0.4", features = ["serde"] }
2041
gdal = { version = "0.17", optional = true }
2142
gdal-sys = { version = "0.10", optional = true }
2243
geo = { version = "0.28", optional = true }
44+
geo-types = { version = "0.7", optional = true }
45+
geoarrow = { git = "https://github.com/geoarrow/geoarrow-rs", rev = "6b877486bf98f280bc04b589eb7ce25b20e629f0", optional = true }
2346
geojson = { version = "0.24" }
2447
log = { version = "0.4" }
48+
parquet = { version = "52", default-features = false, optional = true }
2549
reqwest = { version = "0.12", optional = true, features = ["json", "blocking"] }
2650
serde = { version = "1", features = ["derive"] }
2751
serde_json = { version = "1", features = ["preserve_order"] }
@@ -30,6 +54,7 @@ url = "2"
3054

3155
[dev-dependencies]
3256
assert-json-diff = "2"
57+
bytes = "1"
3358
rstest = "0.22"
3459

3560
[package.metadata.docs.rs]

0 commit comments

Comments
 (0)