ChunkedGeometry into single geometry array #487
-
When reading from a geojson file, the geometry is stored into a chunked geometry array. Getting the results into a single array, does not appear to be straight forward. Is there an existing approach to get this done? here, for example, i can read in a geometry into a use geoarrow::io::geojson::read_geojson;
use geoarrow::array::AsChunkedGeometryArray;
fn main() {
let f = std::fs::File::open("data/rnet_x.geojson").unwrap();
let rnet_x = read_geojson(f, None).unwrap();
let geometry = rnet_x.geometry().unwrap();
let binding = geometry.as_ref();
let x = binding.as_line_string();
let x = x.clone().into_inner();
} To get an iterator through the individual geometries from the ChunkedGeometryArray I figured I can do: x
.chunks()
.into_iter()
.map(|xi| xi.iter())
.flatten(); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
https://github.com/geoarrow/geoarrow-rs/blob/main/src/algorithm/native/concatenate.rs |
Beta Was this translation helpful? Give feedback.
https://github.com/geoarrow/geoarrow-rs/blob/main/src/algorithm/native/concatenate.rs