-
Notifications
You must be signed in to change notification settings - Fork 990
Closed
Description
When asking for the nearest point on line with a valid point and a lineString, at some point it returns an error stating that "coordinates must contain numbers".
However, both the lineString and Point have data. After some debugging, it seems that somewhere in the code a variable intersectPos is set. The variable is checked to be null, however there should also be a check if the array of points does not contain Nan numbers.
I recommend that this check would be fixed with something along the lines of
if (
intersectPos &&
Array.isArray(intersectPos) &&
intersectPos.length === 2 &&
!Number.isNaN(intersectPos[0]) &&
!Number.isNaN(intersectPos[1])
) {
intersectPt = point(intersectPos, {
dist: distance(pt, intersectPos, options),
multiFeatureIndex: multiFeatureIndex,
location: length + distance(start, intersectPos, options),
});
}Metadata
Metadata
Assignees
Labels
No labels
