Closed sethsamuels closed 4 years ago
Thanks for reporting this - it's definitely a bug that needs to be handled.
Glad I can help! I tried using stringi to wrap it with the stri_escape_unicode function, and I tried adding extra backslashes to escape them, and neither approach seems to have worked for me, just fyi.
How did you generate this polyline?
Sorry, just saw this. I scraped the polylines from this page: https://trips.furkot.com/widget/byway/13791.
After fidgeting with it a bit, I think the four backslashes are maybe actually supposed to be two, and R is rendering it as 4, but I'm not sure (and it doesn't seem to make much of a difference in the resulting coordinates).
FWIW, I ended up using the @mapbox/polyline package and routing it all through the command line.
yeah I don't think this is actually a bug, and given you've scraped the polyline, rather than generated it from coordinates, I think you've also scraped the escape \
too.
Ohhhh, huh. Sorry about that!
The function seems to fail when there is a backslash in the encoded polyline. The following polyline can be converted manually, but fails when run through the function (presumably because it wants to treat it as two slashes instead of four):
I realize this issue may be on the Rcpp end, but it seems fairly common for encoded polylines to have backslashes, so I think this is a non-trivial problem.
Also, sorry if you're already aware of this--I tried searching your repo and couldn't find anything about it.