pub fn encode(path: &[[f64; 2]], precision: i32) -> Vec<u8> ⓘ
Expand description
Encodes an array of coordinates into a polyline string
§Arguments
path
- Array of coordinate pairsprecision
- The precision factor (default: 5)
§Examples
use toolbox_rs::polyline::encode;
let path = vec![[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]];
let encoded = encode(&path, 5);
assert_eq!(std::str::from_utf8(&encoded).unwrap(), "_p~iF~ps|U_ulLnnqC_mqNvxq`@");