Polyline icon indicating copy to clipboard operation
Polyline copied to clipboard

Higher precision not reflected in sanity check

Open will-r opened this issue 3 years ago • 0 comments

I have found that a polyline with 1e7 precision will often fail to decode. After some investigation I think the cause is here:

    if (componentCounter == 6) && ((currentChar & 0x20) == 0x20) {
        throw PolylineError.singleCoordinateDecodingError
    }

The limit of five components is easy to exceed with a higher-precision line.

It would be possible to vary the limit, and quite easy if you were able to move to an integer exponent for the precision argument, but I suggest that you could also safely omit this whole sanity check. Big numbers here are implausible but not invalid :)

will-r avatar Sep 21 '21 14:09 will-r