Polyline
Polyline copied to clipboard
Zero-length polyline decodes as only one coordinate
Decoding a zero-length polyline consisting of two coincident endpoints returns an array of only one CLLocationCoordinate2D
, which would be a malformed line string:
decodePolyline("s{byuArigzhF", precision: 1e6)
▿ Optional<LineString>
▿ some : LineString
▿ coordinates : 1 element
▿ 0 : CLLocationCoordinate2D
- latitude : 45.516746
- longitude : -122.605738
By comparison, the @mapbox/polyline
1.1.0 NPM package decodes the same string to GeoJSON as a line string with two coordinates:
polyline.decode('s{byuArigzhF', 6);
{"type":"LineString","coordinates":[[-122.605738,45.516746],[-122.605738,45.51674]]}