24 lines
759 B
Rust
24 lines
759 B
Rust
use fapra_osm_2::coordinates::RadianCoordinate;
|
|
use fapra_osm_2::polygon::Polygon;
|
|
use geojson::FeatureCollection;
|
|
|
|
|
|
/// a simple program to show the geojson export of polygons
|
|
fn main() {
|
|
let nodes = vec![
|
|
RadianCoordinate::from_degrees(10.0, 15.0),
|
|
RadianCoordinate::from_degrees(20.0, 10.0),
|
|
RadianCoordinate::from_degrees(20.0, 25.0),
|
|
RadianCoordinate::from_degrees(10.0, 15.0),
|
|
];
|
|
|
|
let outside1 = RadianCoordinate::from_degrees(30.0, 15.0);
|
|
let outside2 = RadianCoordinate::from_degrees(-10.0, 15.0);
|
|
|
|
let polygon =
|
|
Polygon::build_polygon(nodes, outside1, outside2).expect("error while building polygon");
|
|
|
|
let fc: FeatureCollection = polygon.into();
|
|
|
|
println!("{}", fc.to_string());
|
|
}
|