Skip to content

turf-rhumb-bearing return a valid bearing for coincident points (zero length line) #2478

@smallsaucepan

Description

@smallsaucepan

While taking a look at #2475 noticed turf-rhumb-bearing returns a valid bearing for a line of zero length (its points are coincident).

For example, passing the line [5, 5] -> [5, 5] into turf returns a bearing of 0 (North). This doesn't seem quite right. I understand that's what the math spits out. However, logically how can we say this line runs North? Or alternatively that it doesn't run South?

It should be invalid as it can't be determined. As a comparision Geodesy currently includes a specific check for this and returns NaN.

Please provide the following when reporting an issue:

Turf version: 6.5.0
Code snippet: Pass points at [5, 5] and [5, 5] into turf-rhumb-bearing and get a value of 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions