Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript

Home Page:https://turfjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

smallsaucepan opened this issue · comments

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