-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added convenience wrappers for stringifying geojson (#229)
Co-authored-by: Jere Suikkila <[email protected]>
- Loading branch information
1 parent
bedb195
commit ab5d70d
Showing
3 changed files
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::error::Error; | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
|
||
use geojson::{Feature, GeoJson}; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let file_reader = BufReader::new(File::open("tests/fixtures/canonical/good-feature.geojson")?); | ||
|
||
let feature: Feature = serde_json::from_reader(file_reader)?; | ||
|
||
let geojson: GeoJson = feature.into(); | ||
|
||
println!("{}", &geojson.to_string()); | ||
println!("{}", &geojson.to_string_pretty()?); | ||
|
||
Ok(()) | ||
} |
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