/// Transforms the result of a reachability calculation to a GeoJSON string, ready
/// to be processed in the frontend.
Transforms the result of a reachability calculation to a GeoJSON string, ready
to be processed in the frontend.
Transforms the result of a reachability calculation to a GeoJSON string ready to be processed in the frontend .
fn reachability_res_to_geojson(lat_lon_caps: Vec<Vec<f64>>) -> String {
    let mut features = Vec::new();
    for lat_lon in lat_lon_caps {
        let mut props = BTreeMap::new();
        props.insert(
            String::from("capacity_remaining"),
            lat_lon[2].to_json(),
        );
        features.push(Feature {
            crs: None,
            bbox: None,
            geometry: Some(Geometry::new(
                geojson::Value::Point(lat_lon[0..2].iter()
                    .map(|&y| y as f64).collect::<Vec<_>>())
            )),
            id: None,
            properties: Some(props)
        });
    }
    let geojson = GeoJson::FeatureCollection(FeatureCollection {
        crs: None,
        bbox: None,
        features: features,
    });
    geojson.to_string()
}
fn reachability_res_to_geojson ( lat_lon_caps : Vec < Vec < f64 > > ) -> String { let mut features = Vec :: new ( ) ; for lat_lon in lat_lon_caps { let mut props = BTreeMap :: new ( ) ; props . insert ( String :: from ( " " ) , lat_lon [ 2 ] . to_json ( ) , ) ; features . push ( Feature { crs : None , bbox : None , geometry : Some ( Geometry :: new ( geojson :: Value :: Point ( lat_lon [ 0 .. 2 ] . iter ( ) . map ( | & y | y as f64 ) . collect :: < Vec < _ > > ( ) ) ) ) , id : None , properties : Some ( props ) } ) ; } let geojson = GeoJson :: FeatureCollection ( FeatureCollection { crs : None , bbox : None , features : features , } ) ; geojson . to_string ( ) }
Transforms the result of a reachability calculation to a GeoJSON string, ready
to be processed in the frontend.
Transforms the result of a reachability calculation to a GeoJSON string ready to be processed in the frontend .
lat_lon_caps
Vec<Vec<f64>>