Skip to content

Commit

Permalink
feat(stac): add geoarrow and geoparquet
Browse files Browse the repository at this point in the history
The were their own crates, but that seemed to be overkill.
  • Loading branch information
gadomski committed Aug 30, 2024
1 parent eb1d687 commit 1c3d3ca
Show file tree
Hide file tree
Showing 27 changed files with 214 additions and 377 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ updates:
directory: "/stac"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/python"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/pgstac"
schedule:
Expand All @@ -32,3 +36,7 @@ updates:
directory: "/stac-validate"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/scripts"
schedule:
interval: "weekly"
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ jobs:
args:
- "-p stac"
- "-p stac -F reqwest"
- "-p stac -F geoarrow"
- "-p stac -F geoparquet"
- "-p stac -F geoparquet-compression"
- "-p stac-api"
- "-p stac -p stac-api -F geo"
- "-p stac-arrow"
- "-p stac-async"
- "-p stac-cli --no-default-features"
- "-p stac-geoparquet"
- "-p stac-server --no-default-features"
- "-p stac-server --no-default-features -F axum"
- "-p stac-server --no-default-features -F memory-item-search"
Expand Down
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ members = [
"pgstac",
"python",
"stac-api",
"stac-arrow",
"stac-async",
"stac-cli",
"stac-geoparquet",
"stac-server",
"stac-validate",
]
default-members = [
"python",
"stac",
"stac-api",
"stac-arrow",
"stac-async",
"stac-cli",
"stac-geoparquet",
"stac-server",
"stac-validate",
]
1 change: 1 addition & 0 deletions scripts/requirements-stac-server.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
setuptools
stac-api-validator
12 changes: 7 additions & 5 deletions scripts/requirements-stac-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ attrs==24.2.0
# via
# jsonschema
# referencing
certifi==2024.7.4
certifi==2024.8.30
# via
# requests
# stac-api-validator
Expand All @@ -17,7 +17,7 @@ click==8.1.7
# stac-validator
deepdiff==6.7.1
# via stac-api-validator
idna==3.7
idna==3.8
# via requests
jsonschema==4.23.0
# via
Expand All @@ -29,11 +29,11 @@ jsonschema-specifications==2023.12.1
# via jsonschema
more-itertools==8.14.0
# via stac-api-validator
numpy==2.0.1
numpy==2.1.0
# via shapely
ordered-set==4.1.0
# via deepdiff
orjson==3.10.6
orjson==3.10.7
# via pystac
pystac==1.10.1
# via
Expand Down Expand Up @@ -65,7 +65,9 @@ rpds-py==0.20.0
# via
# jsonschema
# referencing
shapely==2.0.5
setuptools==74.0.0
# via -r scripts/requirements-stac-server.in
shapely==2.0.6
# via stac-api-validator
six==1.16.0
# via python-dateutil
Expand Down
6 changes: 6 additions & 0 deletions scripts/validate-stac-server
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env sh
#
# Validate stac server using stac-api-validator.
#
# To use this script on macos, you'll need `timeout`, which is provided by Homebrew's coreutils:
#
# brew install coreutils

set -e

Expand Down
30 changes: 0 additions & 30 deletions stac-arrow/Cargo.toml

This file was deleted.

35 changes: 0 additions & 35 deletions stac-arrow/README.md

This file was deleted.

1 change: 0 additions & 1 deletion stac-arrow/data

This file was deleted.

5 changes: 3 additions & 2 deletions stac-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ clap = { version = "4", features = ["derive"] }
reqwest = "0.12"
serde = "1"
serde_json = "1"
stac = { version = "0.8", path = "../stac" }
stac = { version = "0.8", path = "../stac", features = [
"geoparquet-compression",
] }
stac-api = { version = "0.4", path = "../stac-api" }
stac-async = { version = "0.5", path = "../stac-async" }
stac-geoparquet = { version = "0.0.1", path = "../stac-geoparquet" }
stac-server = { version = "0.1", path = "../stac-server", features = [
"memory-item-search",
"tokio",
Expand Down
4 changes: 0 additions & 4 deletions stac-cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ pub enum Error {
#[error(transparent)]
StacAsync(#[from] stac_async::Error),

/// [stac_geoparquet::Error]
#[error(transparent)]
StacGeoparquet(#[from] stac_geoparquet::Error),

/// [stac_server::Error]
#[error(transparent)]
StacServer(#[from] stac_server::Error),
Expand Down
6 changes: 3 additions & 3 deletions stac-cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ impl Format {
match *self {
Format::Parquet => {
let item_collection = if let Some(url) = stac::href_to_url(href) {
stac_geoparquet::from_reader(reqwest::blocking::get(url)?.bytes()?)?
stac::geoparquet::from_reader(reqwest::blocking::get(url)?.bytes()?)?
} else {
let file = File::open(href)?;
stac_geoparquet::from_reader(file)?
stac::geoparquet::from_reader(file)?
};
serde_json::from_value(serde_json::to_value(item_collection)?)
.map_err(Error::from)
Expand All @@ -41,7 +41,7 @@ impl Format {
Format::Parquet => {
let mut buf = Vec::new();
let _ = std::io::stdin().read_to_end(&mut buf)?;
let item_collection = stac_geoparquet::from_reader(Bytes::from(buf))?;
let item_collection = stac::geoparquet::from_reader(Bytes::from(buf))?;
serde_json::from_value(serde_json::to_value(item_collection)?)
.map_err(Error::from)
}
Expand Down
2 changes: 1 addition & 1 deletion stac-cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ where
}
Format::Parquet => {
if let Some(value) = value.to_stac() {
stac_geoparquet::to_writer(&mut self.writer, value)?;
stac::geoparquet::to_writer(&mut self.writer, value)?;
} else {
writeln!(self.writer, "{}", value)?;
}
Expand Down
34 changes: 0 additions & 34 deletions stac-geoparquet/Cargo.toml

This file was deleted.

52 changes: 0 additions & 52 deletions stac-geoparquet/README.md

This file was deleted.

1 change: 0 additions & 1 deletion stac-geoparquet/data

This file was deleted.

Binary file removed stac-geoparquet/examples/extended-item.parquet
Binary file not shown.
1 change: 1 addition & 0 deletions stac/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `Bbox` ([#303](https://github.com/stac-utils/stac-rs/pull/303))
- Functions to create collections from items ([#304](https://github.com/stac-utils/stac-rs/pull/304))
- Default implementation for `Version` ([#309](https://github.com/stac-utils/stac-rs/pull/309))
- Experimental GeoParquet and GeoArrow support ([#316](https://github.com/stac-utils/stac-rs/pull/316))

### Changed

Expand Down
26 changes: 26 additions & 0 deletions stac/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,40 @@ categories = ["science", "data-structures"]
[features]
gdal = ["dep:gdal", "dep:gdal-sys"]
geo = ["dep:geo"]
geoarrow = [
"dep:geoarrow",
"dep:arrow-array",
"dep:arrow-cast",
"dep:arrow-json",
"dep:arrow-schema",
"dep:geo-types",
]
geoparquet = ["geoarrow/parquet", "dep:parquet"]
geoparquet-compression = [
"geoparquet",
"geoarrow/parquet_compression",
"parquet/snap",
"parquet/brotli",
"parquet/flate2",
"parquet/lz4",
"parquet/zstd",
]
reqwest = ["dep:reqwest"]

[dependencies]
arrow-array = { version = "52", optional = true }
arrow-cast = { version = "52", optional = true }
arrow-json = { version = "52", optional = true }
arrow-schema = { version = "52", optional = true }
chrono = { version = "0.4", features = ["serde"] }
gdal = { version = "0.17", optional = true }
gdal-sys = { version = "0.10", optional = true }
geo = { version = "0.28", optional = true }
geo-types = { version = "0.7", optional = true }
geoarrow = { git = "https://github.com/geoarrow/geoarrow-rs", rev = "6b877486bf98f280bc04b589eb7ce25b20e629f0", optional = true }
geojson = { version = "0.24" }
log = { version = "0.4" }
parquet = { version = "52", default-features = false, optional = true }
reqwest = { version = "0.12", optional = true, features = ["json", "blocking"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
Expand All @@ -30,6 +55,7 @@ url = "2"

[dev-dependencies]
assert-json-diff = "2"
bytes = "1"
rstest = "0.22"

[package.metadata.docs.rs]
Expand Down
Loading

0 comments on commit 1c3d3ca

Please sign in to comment.