PolylineEncoding
Encodes and decodes coordinate sequences using the Encoded Polyline Algorithm.
The encoding logic is run following steps. Decoding the same in reversed order.
Take the initial signed value
Take the decimal value and multiply it by 10^precision, rounding the result
Convert the decimal value to binary. Note that a negative value must be calculated using its two's complement by inverting the binary value and adding one to the result:
Left-shift the binary value one bit:
If the original decimal value is negative, invert this encoding
Break the binary value out into 5-bit chunks (starting from the right hand side)
Place the 5-bit chunks into reverse order
OR each value with 0x20 if another bit chunk follows
Convert each value to decimal
Add 63 to each value
Convert each value to its ASCII equivalent