mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix bug
This commit is contained in:
@@ -11,37 +11,46 @@ import org.junit.Test;
|
||||
*/
|
||||
public class CoordinateUtilTest {
|
||||
|
||||
@Test
|
||||
public void wgs84ToGcj02Test(){
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.wgs84ToGcj02(116.404, 39.915);
|
||||
Assert.assertEquals(116.41033392216508D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.91640428150164D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gcj02ToWgs84Test(){
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.gcj02ToWgs84(116.404, 39.915);
|
||||
Assert.assertEquals(116.39766607783491D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.91359571849836D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wgs84toBd09Test(){
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.wgs84ToBd09(116.404, 39.915);
|
||||
Assert.assertEquals(116.41671695444782D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.922698713521726D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bd09toWgs84Test(){
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.bd09toWgs84(116.404, 39.915);
|
||||
Assert.assertEquals(116.39129143419822D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.907253214522164D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gcj02ToBd09Test() {
|
||||
final CoordinateUtil.Coordinate gcj02 = CoordinateUtil.gcj02ToBd09(116.404, 39.915);
|
||||
Assert.assertEquals(116.41036949371029D, gcj02.getLng(), 15);
|
||||
Assert.assertEquals(39.92133699351021D, gcj02.getLat(), 15);
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.gcj02ToBd09(116.404, 39.915);
|
||||
Assert.assertEquals(116.41036949371029D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.92133699351022D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bd09toGcj02Test(){
|
||||
final CoordinateUtil.Coordinate gcj02 = CoordinateUtil.bd09ToGcj02(116.404, 39.915);
|
||||
Assert.assertEquals(116.39762729119315D, gcj02.getLng(), 15);
|
||||
Assert.assertEquals(39.90865673957631D, gcj02.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gcj02ToWgs84(){
|
||||
final CoordinateUtil.Coordinate gcj02 = CoordinateUtil.wgs84ToGcj02(116.404, 39.915);
|
||||
Assert.assertEquals(116.39775550083061D, gcj02.getLng(), 15);
|
||||
Assert.assertEquals(39.91359571849836D, gcj02.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wgs84ToGcj02Test(){
|
||||
final CoordinateUtil.Coordinate gcj02 = CoordinateUtil.wgs84ToGcj02(116.404, 39.915);
|
||||
Assert.assertEquals(116.41024449916938D, gcj02.getLng(), 15);
|
||||
Assert.assertEquals(39.91640428150164D, gcj02.getLat(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wgs84toBd09(){
|
||||
|
||||
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.bd09ToGcj02(116.404, 39.915);
|
||||
Assert.assertEquals(116.39762729119315D, coordinate.getLng(), 15);
|
||||
Assert.assertEquals(39.90865673957631D, coordinate.getLat(), 15);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user