MercatorPoint { @Nonnull public static GeoPoint mercsToLatLon(final double mercX, final double mercY) { assert MathUtils.isBetween(mercX, 0.0, 1.0) : mercX; assert MathUtils.isBetween(mercY, 0.0, 1.0) : mercY; final double geoX = (mercX - 0.5) * MapConst.WORLD_SIZE; final double geoY = (mercY - 0.5) * -MapConst.WORLD_SIZE; final double lat = (Math.toDegrees(Math.atan(Math.exp(geoY / MapConst.WORLD_RADIUS))) * 2.0) - 90.0; final double lon = Math.toDegrees(geoX / MapConst.WORLD_RADIUS); return new GeoPoint(lat, lon); } MercatorPoint(
            final double mercX,
            final double mercY); double getMercX(); double getMercY(); @Nonnull static GeoPoint mercsToLatLon(final double mercX, final double mercY); @Nonnull static GeoPoint mercsToLatLon(@Nonnull final MercatorPoint mercs); @Nonnull static MercatorPoint latLonToMercs(@Nonnull final GeoPoint point); @Nonnull static MercatorPoint latLonToMercs(final double lat, final double lon); boolean canEqual(@Nonnull final Object obj); @Override boolean equals(@Nullable final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testMercsToLatLon() { LOG.info("testMercsToLatLon"); Assert.assertEquals(MercatorPoint.mercsToLatLon(new MercatorPoint(0.5, 0.5)), new GeoPoint(0.0, 0.0)); GeoPoint expected = MercatorPoint.mercsToLatLon(new MercatorPoint(0.0, 0.0)); Assert.assertTrue(expected.toString(), MathUtils.isBetween(expected.getLat(), 85.0, 86.0)); Assert.assertTrue(expected.toString(), MathUtils.isBetween(expected.getLon(), -180.0, -179.9)); expected = MercatorPoint.mercsToLatLon(new MercatorPoint(1.0, 1.0)); Assert.assertTrue(expected.toString(), MathUtils.isBetween(expected.getLat(), -86.0, -85.0)); Assert.assertTrue(expected.toString(), MathUtils.isBetween(expected.getLon(), 179.9, 180.0)); }