New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed line-offset algorithm to account for spherical coordinates #1949
base: master
Are you sure you want to change the base?
Conversation
Hi @PereUbu7. Understand it's been a while since you proposed this. Are you still interested in getting this merged with some assistance from us? |
@smallsaucepan Hi there! I'd love to. Just got to refresh and recapitulate what this was all about :) |
@smallsaucepan Hi again. I've written some unit tests for the process segment method in vanilla js. Could you guys help putting this in the test framework you're actually using and maybe remove any old tests if there are any? :) ` const IsWithin = (value1, value2, variance) => { const MeterInKm = 0.001; const TestAbsoluteDistance = (point1, point2) => {
}; const TestDistanceFromPoints = (point1, point2) => {
}; const TestBearing = (point1, point2) => {
}; TestAbsoluteDistance([0.0, 0.0], [0.0, 0.0 + KmInDegrees]); TestAbsoluteDistance([0.0, 45.0], [0.0, 45.0 + KmInDegrees]); TestAbsoluteDistance([0.0, 65.0], [0.0, 65.0 + KmInDegrees]); TestAbsoluteDistance([30.0, 65.0], [30.0, 65.0 + KmInDegrees]); TestDistanceFromPoints([0.0, 0.0], [0.0, 0.0 + KmInDegrees]); TestDistanceFromPoints([0.0, 45.0], [0.0, 45.0 + KmInDegrees]); TestDistanceFromPoints([0.0, 65.0], [0.0, 65.0 + KmInDegrees]); TestDistanceFromPoints([30.0, 65.0], [30.0, 65.0 + KmInDegrees]); TestBearing([0.0, 0.0], [0.0, 0.0 + KmInDegrees]); TestBearing([0.0, 45.0], [0.0, 45.0 + KmInDegrees]); TestBearing([0.0, 65.0], [0.0, 65.0 + KmInDegrees]); TestBearing([30.0, 65.0], [30.0, 65.0 + KmInDegrees]); So, the TestAbsoluteDistance checks that the actual offset is correct, and the TestDistanceFromPoints checks that the two new points are at the same distance from their orignal points (on a local scale), and the TestBearing checks that the line that crosses the two new points has the same bearing as the old line (on a local scale again). Do you guys think we need some more tests? Is is possible to add some comment to the lineOffset function that is is only correct locally (up to some 10s kms)? Greetings, |
Since the current algorithm is only correct at the equator i'm suggesting the following change: