Encoded polylines
A route or shape is naturally a list of coordinates, but sending hundreds of floating-point numbers is wasteful. The Google encoded polyline format squeezes that path into a single short string that map and routing APIs understand directly.
How it works
Each coordinate is multiplied by ten to the precision (100000 for precision 5) and rounded to an integer. The algorithm then stores the delta from the previous point. Each delta is left-shifted by one bit, inverted if negative, split into 5 bit chunks, and each chunk has 0x20 OR-ed in while more chunks follow before adding 63 to land in printable ASCII.
[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]
-> _p~iF~ps|U_ulLnnqC_mqNvxq`@
The first point is encoded as a delta from zero, so the string is fully self-contained.
Example and tips
Always match the precision when decoding, or the coordinates come out scaled wrongly. Order matters: the points must be listed in path order because the encoding is delta-based. If your data comes from OSRM, Valhalla or another high-precision engine, select precision 6; for the Google Directions API use precision 5.