initial commit

This commit is contained in:
Johannes Erwerle 2022-08-05 10:03:57 +02:00
commit 32e68ee635
12 changed files with 3012 additions and 0 deletions

24
src/bin/polygon_print.rs Normal file
View file

@ -0,0 +1,24 @@
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());
}