Skip to content

point.distanceTo can return NaN when measuring small/no distances #1

@stensrud

Description

@stensrud

Measuring the distance from [60.512651558965445, 6.67020027525723] to [60.512651558965445, 6.670200191438198] returns a NaN result.

The expression Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2) gives a result of 1.0000000000000002 which is not defined for the arccosine function Math.acos to which this result is sent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions