mapbox / mapbox/turf-swift

0.5.0 to 1.2.0 versions are not giving me right values for LineString.closestCoordinate(to:) function

Open
#142 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-sync-complete
Dominant language
Swift
Stars
271
Forks
65
PR merge metrics
No merged PRs in 30d

Description

0.5.0 to 1.2.0 versions are not giving me right values for LineString.closestCoordinate(to:) function.

My project's current version is 0.3.0 and was able to calculate re-route when the distance between the current location and the current step's polyline is more than 100 or 200 meters.
I have upgraded to 1.2.0 and I am not able to request for rerouting since closestCoordinate function is not returning proper value. Even 0.5.0 also not returning me proper values (IndexedCoordinate).
But I am able to get proper values if I use 0.4.0 version.

Previously I were using Polyline(coordinates) to create a polyline, But after upgrading to 0.4.0 or higher version, I have used LineString(coordinates) to create the polyline which can be used to get the closestCoordinate (IndexedCoordinate). This IndexedCoordinate always showing a distance of either 46.7*** or -1.*** even though I had travelled for more than 50km.

github "mapbox/turf-swift" ~> 1.2
github "mapbox/turf-swift" == 1.2.0

I have added the library using the above two ways in my cartfile.

Please guide me to resolve my issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing LineString.closestCoordinate(to:) with the same coordinates across versions 0.3.0, 0.4.0, 0.5.0, and 1.2.0, comparing the returned IndexedCoordinate values. Inspect the function and its version history to isolate the regression; done means the closest coordinate and distance support the reported rerouting calculation again.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.