Skip to content

Commit

Permalink
Fix python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Dec 23, 2024
1 parent 5e4f644 commit e5a9f57
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
94 changes: 47 additions & 47 deletions python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions python/pyo3-geoarrow/src/ffi/from_python/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::sync::Arc;

use crate::array::*;
use crate::scalar::*;
use geoarrow::datatypes::Dimension;
use geoarrow::io::geozero::ToMixedArray;
use geoarrow::io::geozero::ToGeometryArray;
use geoarrow::scalar::GeometryScalar;
use geozero::geojson::GeoJsonString;
use pyo3::exceptions::PyValueError;
Expand All @@ -24,9 +23,9 @@ impl<'a> FromPyObject<'a> for PyGeometry {
// Parse GeoJSON to geometry scalar
let reader = GeoJsonString(json_string);

// TODO: we need a dynamic dimensionality reader
// TODO: use ToGeometry directly in the future?
let arr = reader
.to_mixed_geometry_array(Dimension::XY)
.to_geometry_array()
.map_err(|err| PyValueError::new_err(err.to_string()))?;
Ok(Self(
GeometryScalar::try_new(Arc::new(arr))
Expand Down

0 comments on commit e5a9f57

Please sign in to comment.