From f10e7c7e8d53005dca9570708d014228931b061c Mon Sep 17 00:00:00 2001 From: clarisma <56932851+clarisma@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:10:54 +0200 Subject: [PATCH] Update Mercator.java --- src/main/java/com/geodesk/geom/Mercator.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/geodesk/geom/Mercator.java b/src/main/java/com/geodesk/geom/Mercator.java index 2d25d30..5a29fc7 100644 --- a/src/main/java/com/geodesk/geom/Mercator.java +++ b/src/main/java/com/geodesk/geom/Mercator.java @@ -18,7 +18,7 @@ * (in essence, the value range fully uses a 32-bit signed * int; a pair of coordinates fits into a 64-bit signed long). * - * This projection is compatible with Web Mercator EPSG:3785, + * This projection is compatible with Web Mercator EPSG:3857, * except that instead of meters at the Equator, it uses a made-up * unit called "imp" ("integer, Mercator-projected"). * @@ -122,6 +122,12 @@ public static double lonFromX(double x) return x * 360 / MAP_WIDTH; } + public static double lonPrecision7fromX(double x) + { + double lon = lonFromX(x); + return ((double)Math.round(lon * 10000000)) / 10000000; + } + /** * Converts a projected latitude to WGS84. * @@ -134,6 +140,12 @@ public static double latFromY(double y) * 360 / Math.PI - 90; } + public static double latPrecision7fromY(double y) + { + double lat = latFromY(y); + return ((double)Math.round(lat * 10000000)) / 10000000; + } + public static double metersAtY(int y) { return EARTH_CIRCUMFERENCE / MAP_WIDTH / scale(y);