@@ -20,12 +20,12 @@ pub fn has_extension(href: &str) -> bool {
2020}
2121
2222#[ cfg( feature = "geoparquet" ) ]
23- pub use has_feature:: { from_reader, to_writer} ;
23+ pub use has_feature:: { from_reader, to_writer, to_writer_with_options } ;
2424
2525#[ cfg( feature = "geoparquet" ) ]
2626mod has_feature {
2727 use crate :: { Error , ItemCollection , Result , Value } ;
28- use geoarrow:: io:: parquet:: GeoParquetRecordBatchReaderBuilder ;
28+ use geoarrow:: io:: parquet:: { GeoParquetRecordBatchReaderBuilder , GeoParquetWriterOptions } ;
2929 use parquet:: file:: reader:: ChunkReader ;
3030 use std:: io:: Write ;
3131
@@ -46,6 +46,35 @@ mod has_feature {
4646 /// stac::geoparquet::to_writer(&mut cursor, item.into()).unwrap();
4747 /// ```
4848 pub fn to_writer < W > ( writer : W , value : Value ) -> Result < ( ) >
49+ where
50+ W : Write + Send ,
51+ {
52+ to_writer_with_options ( writer, value, & Default :: default ( ) )
53+ }
54+
55+ /// Writes a [Value] to a [std::io::Write] as
56+ /// [stac-geoparquet](https://github.com/stac-utils/stac-geoparquet) with the provided options.
57+ ///
58+ /// # Examples
59+ ///
60+ /// ```
61+ /// use std::io::Cursor;
62+ /// use stac::Item;
63+ /// use geoarrow::io::parquet::GeoParquetWriterOptions;
64+ /// use parquet::{basic::Compression, file::properties::WriterProperties};
65+ ///
66+ /// let item: Item = stac::read("examples/simple-item.json").unwrap();
67+ /// let mut cursor = Cursor::new(Vec::new());
68+ /// let mut options = GeoParquetWriterOptions::default();
69+ /// let writer_properties = WriterProperties::builder().set_compression(Compression::SNAPPY).build();
70+ /// options.writer_properties = Some(writer_properties);
71+ /// stac::geoparquet::to_writer_with_options(&mut cursor, item.into(), &options).unwrap();
72+ /// ```
73+ pub fn to_writer_with_options < W > (
74+ writer : W ,
75+ value : Value ,
76+ options : & GeoParquetWriterOptions ,
77+ ) -> Result < ( ) >
4978 where
5079 W : Write + Send ,
5180 {
@@ -55,7 +84,7 @@ mod has_feature {
5584 geoarrow:: io:: parquet:: write_geoparquet (
5685 table. into_record_batch_reader ( ) ,
5786 writer,
58- & Default :: default ( ) ,
87+ options ,
5988 )
6089 . map_err ( Error :: from)
6190 }
0 commit comments