/// Transforms the result of a route calculation into a GeoJSON, convenient for sending
/// over the Internet.
Transforms the result of a route calculation into a GeoJSON, convenient for sending
over the Internet.
Transforms the result of a route calculation into a GeoJSON convenient for sending over the Internet .
fn route_res_to_geojson(lat_lons: Vec<Vec<f64>>, cost: f32) -> String {
    let geometry = Geometry::new(
        geojson::Value::LineString(lat_lons.iter().map(|x|
            x.iter().map(|&y| y).collect::<Vec<_>>()
        ).collect::<Vec<_>>())
    );
    let mut properties = BTreeMap::new();
    properties.insert(
        String::from("total_cost"),
        cost.to_json(),
    );
    let geojson = GeoJson::Feature(Feature {
        crs: None,
        bbox: None,
        geometry: Some(geometry),
        id: None,
        properties: Some(properties),
    });
    geojson.to_string()
}
fn route_res_to_geojson ( lat_lons : Vec < Vec < f64 > > , cost : f32 ) -> String { let geometry = Geometry :: new ( geojson :: Value :: LineString ( lat_lons . iter ( ) . map ( | x | x . iter ( ) . map ( | & y | y ) . collect :: < Vec < _ > > ( ) ) . collect :: < Vec < _ > > ( ) ) ) ; let mut properties = BTreeMap :: new ( ) ; properties . insert ( String :: from ( " " ) , cost . to_json ( ) , ) ; let geojson = GeoJson :: Feature ( Feature { crs : None , bbox : None , geometry : Some ( geometry ) , id : None , properties : Some ( properties ) , } ) ; geojson . to_string ( ) }
Transforms the result of a route calculation into a GeoJSON, convenient for sending
over the Internet.
Transforms the result of a route calculation into a GeoJSON convenient for sending over the Internet .
lat_lons
Vec<Vec<f64>>
cost
f32