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 3a8cbba
Show file tree
Hide file tree
Showing 28 changed files with 216 additions and 379 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
4 changes: 2 additions & 2 deletions scripts/validate-stac-geoparquet
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def clean_report(report: dict[str, Any]) -> dict[str, Any]:
try:
# Writing
subprocess.check_call(
["cargo", "run", "--no-default-features", "--", "translate", path, parquet_path]
["cargo", "run", "--no-default-features", "-F", "geoparquet-compression", "--", "translate", path, parquet_path]
)
table = pyarrow.parquet.read_table(parquet_path)
after = next(stac_geoparquet.arrow.stac_table_to_items(table))
Expand All @@ -55,7 +55,7 @@ try:
table = stac_geoparquet.arrow.parse_stac_items_to_arrow([before])
stac_geoparquet.arrow.to_parquet(table, parquet_path)
item_collection = json.loads(subprocess.check_output(
["cargo", "run", "--no-default-features", "--", "translate", parquet_path]
["cargo", "run", "--no-default-features", "-F", "geoparquet-compression", "--", "translate", parquet_path]
))
assert len(item_collection["features"]) == 1
clean_item(item_collection["features"][0]) # stac-geoparquet writes as a multi-polygon
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
Loading

0 comments on commit 3a8cbba

Please sign in to comment.