[][src]Crate polyline

Google Encoded Polyline encoding & decoding in Rust

Polyline is a lossy compression algorithm that allows you to store a series of coordinates as a single string.

Example

Points: (38.5, -120.2), (40.7, -120.95), (43.252, -126.453)

Encoded polyline: "_p~iF~ps|U_ulLnnqC_mqNvxq`@""

use polyline;
use geo_types::line_string;

let coord = line_string![(x: -120.2, y: 38.5), (x: -120.95, y: 40.7), (x: -126.453, y: 43.252)];
let output = "_p~iF~ps|U_ulLnnqC_mqNvxq`@";
let result = polyline::encode_coordinates(coord, 5).unwrap();
assert_eq!(result, output)

Functions

decode_polyline

Decodes a Google Encoded Polyline.

encode_coordinates

Encodes a Google Encoded Polyline.