1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

add great circle distance calc

This commit is contained in:
oblonski 2014-11-28 10:30:06 +01:00
parent 600e29f353
commit 5d0a962e24
3 changed files with 105 additions and 7 deletions

View file

@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package jsprit.core.util;
import junit.framework.Assert;
import org.junit.Test;
/**
* Created by schroeder on 28.11.14.
*/
public class GreatCircleDistanceCalculatorTest {
@Test
public void test(){
double lon1 = 8.3858333;
double lat1 = 49.0047222;
double lon2 = 12.1333333;
double lat2 = 54.0833333;
double greatCircle = GreatCircleDistanceCalculator.calculateDistance(
Coordinate.newInstance(lon1,lat1),
Coordinate.newInstance(lon2,lat2)
);
Assert.assertEquals(600,greatCircle,30.);
}
}