I can't decode a polyline
roskee opened this issue · 1 comments
roskee commented
I don't know what the problem is but decoding the following polyline string generates an ErrEmpty
. I tested the polyline on google and it has many points.
polylineStr := "u@g~xkF????CHOf@ETI`Qx@GXKb@CLu@vBk@rAw@lBiAdEcAdDc@vAc@rAKGIGMGKIMIMEO@K@O@sAs@aAa@"
c, _, err := poyline.DecodeCoords([]byte(polylineStr))
// err is ErrEmpty
twpayne commented
This polyline has an odd number of elements, meaning that the final coordinate is not complete. If you paste it into https://developers.google.com/maps/documentation/utilities/polylineutility you will see that, after you click "Decode Polyline", the page adds an extra @@
at the end of the string to correct it. This library only encodes and decodes polylines. It does not correct them.
tl;dr this polyline is not valid.