Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero-length polyline decodes as only one coordinate #59

Open
1ec5 opened this issue Sep 8, 2020 · 0 comments
Open

Zero-length polyline decodes as only one coordinate #59

1ec5 opened this issue Sep 8, 2020 · 0 comments
Labels

Comments

@1ec5
Copy link
Collaborator

1ec5 commented Sep 8, 2020

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]]}
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant