-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
newline-delimited GeoJSON writer (#535)
- Loading branch information
1 parent
0ec47c3
commit 99b7cfe
Showing
6 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
//! Read from [newline-delimited GeoJSON](https://stevage.github.io/ndgeojson/) files. | ||
//! Read from and write to [newline-delimited GeoJSON](https://stevage.github.io/ndgeojson/) files. | ||
|
||
mod reader; | ||
mod writer; | ||
|
||
pub use reader::read_geojson_lines; | ||
pub use writer::write_geojson_lines; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use geozero::geojson::GeoJsonLineWriter; | ||
use geozero::GeozeroDatasource; | ||
use std::io::Write; | ||
|
||
use crate::error::Result; | ||
use crate::table::GeoTable; | ||
|
||
/// Write a table to newline-delimited GeoJSON | ||
pub fn write_geojson_lines<W: Write>(table: &mut GeoTable, writer: W) -> Result<()> { | ||
let mut geojson_writer = GeoJsonLineWriter::new(writer); | ||
table.process(&mut geojson_writer)?; | ||
Ok(()) | ||
} |