-
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
- Loading branch information
1 parent
439c384
commit 5d033b6
Showing
3 changed files
with
34 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.clone().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