Turf: @turf/rhumb-destination issue at 180th meridian

Created on 29 May 2017  路  5Comments  路  Source: Turfjs/turf

The 180th meridian problem

When rhumb-destination crosses the 180th meridian from east to west, for example from an origin with negative longitude (i.e. -179.5) to a destination point 100 kilometers west of it, it returns a positive longitude for the destination, which is generally interpreted by the Map (i.e. Bing/Google) as a point at the other side of the map.

Example:

var destination = getCoord(rhumbDestination(point([-179.5, 16.5]), 100, -90));

Current output: //= [ 179.56205350889832, -16.5]
screen shot 2017-05-29 at 1 44 28 am

Solution

A quick solution that works for most Web Mercator Maps is to return a longitude value greater than 180 degrees.
Correct/expected output://= [-180.4379464911, -16.5]
screen shot 2017-05-29 at 1 52 47 am

bug

All 5 comments

@DenisCarriere out of curiosity, what does this mean? What tasks?
screen shot 2017-05-29 at 2 50 14 am

Those 3 of 3 tasks show up when you add bullets/lists in your first comment for PRs & Issues.

  • [ ] Task uncompleted
  • [x] Task completed

馃憤 This issue, also this will help calculating distances using both Rhumb Line & Haversine formulas.

Shall I create a new PR like 180th meridian fix to fix the issue in all related modules? Do we need also a new issue?

Submitting a new PR is useful to contain all edits related to a specific issue or a new feature.

No need to create a new issue.

Issues are used as references, something you point your PR to or simply add all the details of the issue in the PR itself. You've already identified the 180th meridian issue here, just reference your PR to this issue since it's practically the same thing.

Major Release

We might want to consider doing a breaking change (Major release) for @turf/destination since many other modules/libraries might depend on it in it's current state.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amishas157 picture amishas157  路  3Comments

alexgleith picture alexgleith  路  5Comments

stebogit picture stebogit  路  5Comments

Spown picture Spown  路  3Comments

tsemerad picture tsemerad  路  4Comments