From 1950b783ab19e754ab98202fa1747ca491e4efb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E9=BB=84=E8=9C=82coder?= Date: Mon, 26 Dec 2022 17:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A320037508=E4=B8=8D=E4=B8=8D?= =?UTF-8?q?=E5=87=86=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/hutool/core/util/CoordinateUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/util/CoordinateUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/CoordinateUtil.java index 554962c9e..67c53fbd4 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/CoordinateUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/CoordinateUtil.java @@ -141,9 +141,9 @@ public class CoordinateUtil { * @return 墨卡托投影 */ public static Coordinate wgs84ToMercator(double lng, double lat) { - double x = lng * 20037508.342789 / 180; + double x = lng * 20037508.342789244 / 180; double y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180); - y = y * 20037508.34789 / 180; + y = y * 20037508.342789244 / 180; return new Coordinate(x, y); } @@ -155,8 +155,8 @@ public class CoordinateUtil { * @return WGS84 坐标 */ public static Coordinate mercatorToWgs84(double mercatorX, double mercatorY) { - double x = mercatorX / 20037508.34 * 180; - double y = mercatorY / 20037508.34 * 180; + double x = mercatorX / 20037508.342789244 * 180; + double y = mercatorY / 20037508.342789244 * 180; y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2); return new Coordinate(x, y); }