Skip to content

Commit baa0fb5

Browse files
committed
feat: update geopandas notebook
1 parent faaa18b commit baa0fb5

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

Cargo.lock

Lines changed: 17 additions & 17 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212
clap = "4.5.31"
1313
geojson = "0.24.1"
1414
geoarrow = "0.4.0-beta.3"
15-
pyo3 = { version = "0.23.4", features = ["extension-module"] }
15+
pyo3 = { version = "0.23.5", features = ["extension-module"] }
1616
pyo3-async-runtimes = { version = "0.23.0", features = [
1717
"tokio",
1818
"tokio-runtime",

src/arrow.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,19 @@ pub fn to_arrow(py: Python<'_>, items: Bound<PyAny>) -> PyResult<PyObject> {
3636
} else {
3737
serde_json::from_value(value).map_err(Error::from)?
3838
};
39-
let (record_batches, schema) = stac::geoarrow::to_table(item_collection)
39+
// TODO we might want to just allow use to go WKB right when we got to table?
40+
let (record_batches, mut schema) = stac::geoarrow::to_table(item_collection)
4041
.map_err(Error::from)?
4142
.into_inner();
43+
let record_batches = record_batches
44+
.into_iter()
45+
.map(|record_batch| {
46+
stac::geoarrow::with_wkb_geometry(record_batch, "geometry").map_err(Error::from)
47+
})
48+
.collect::<Result<Vec<_>>>()?;
49+
if !record_batches.is_empty() {
50+
schema = record_batches[0].schema();
51+
}
4252
let table = PyTable::try_new(record_batches, schema)?;
4353
let table = table.to_arro3(py)?;
4454
Ok(table.into_py_any(py)?)

0 commit comments

Comments
 (0)