반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | private static Map<String, Object> EPGS4326_900913(double lon, double lat){ double x = lon * 20037508.34 / 180; double y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180); y = y * 20037508.34 / 180; Map<String, Object> map = new HashMap<String, Object>(); map.put("x", x); map.put("y", y); System.out.println(lon+":"+x); System.out.println(lat+":"+y); return map; } private static Map<String, Object> EPGS900913_4326(double x, double y){ double lon = (x / 20037508.34) * 180; double lat = (y / 20037508.34) * 180; lat = 180/Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2); Map<String, Object> map = new HashMap<String, Object>(); map.put("lon", lon); map.put("lat", lat); System.out.println(x+":"+lon); System.out.println(y+":"+lat); return map; } | cs |