polyline_decoding algorithm