File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
geopolars/geopolars-arrow/src Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11pub mod to_arrow;
2- mod to_geoarrow;
2+ pub mod to_geoarrow;
33pub mod to_polars;
Original file line number Diff line number Diff line change 1+ use std:: sync:: Arc ;
2+
3+ use geoarrow_array:: { GeoArrowArray , WrapArray } ;
4+ use geoarrow_schema:: GeoArrowType ;
5+
6+ use crate :: to_arrow:: polars_to_arrow;
7+
8+ /// Convert a polars-arrow Array to a GeoArrow array
9+ pub fn polars_to_geoarrow ( array : polars_arrow:: array:: ArrayRef ) -> Arc < dyn GeoArrowArray > {
10+ let ( arrow_array, arrow_field) = polars_to_arrow ( array) ;
11+
12+ let geoarrow_data_type =
13+ GeoArrowType :: from_arrow_field ( & arrow_field) . expect ( "import to geoarrow" ) ;
14+ geoarrow_data_type
15+ . wrap_array ( & arrow_array)
16+ . expect ( "import to geoarrow" )
17+ }
You can’t perform that action at this time.
0 commit comments