1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use anyhow::Result;

use geom::LonLat;

pub fn run(path: String) -> Result<()> {
    let buffer = std::fs::read_to_string(path)?;
    for (idx, points) in LonLat::parse_geojson_polygons(buffer)?
        .into_iter()
        .enumerate()
    {
        let path = format!("boundary{}.poly", idx);
        LonLat::write_osmosis_polygon(&path, &points)?;
        println!("Wrote {}", path);
    }
    Ok(())
}