@Test public void testGetAround() { Map<String, Double> map = MapDistance.getAround(117.11811, 36.68484, 13000); assertEquals(map.get("maxLat"), Double.valueOf("36.941095784459634")); assertEquals(map.get("minLat"), Double.valueOf("36.42858421554037")); assertEquals(map.get("minLng"), Double.valueOf("117.001301883613")); assertEquals(map.get("maxLng"), Double.valueOf("117.234918116387")); }
public static Map<String, Double> getAround(double lng, double lat, double raidusMile) { Map<String, Double> map = new HashMap<>(); double degree = (24901 * 1609) / 360.0; double mpdLng = Double.parseDouble((degree * Math.cos(lng * (Math.PI / 180)) + "").replace("-", "")); double dpmLng = 1 / mpdLng; double radiusLng = dpmLng * raidusMile; double minLat = lat - radiusLng; double maxLat = lat + radiusLng; double dpmLat = 1 / degree; double radiusLat = dpmLat * raidusMile; double minLng = lng - radiusLat; double maxLng = lng + radiusLat; map.put("minLat", minLat); map.put("maxLat", maxLat); map.put("minLng", minLng); map.put("maxLng", maxLng); return map; }
MapDistance { public static Map<String, Double> getAround(double lng, double lat, double raidusMile) { Map<String, Double> map = new HashMap<>(); double degree = (24901 * 1609) / 360.0; double mpdLng = Double.parseDouble((degree * Math.cos(lng * (Math.PI / 180)) + "").replace("-", "")); double dpmLng = 1 / mpdLng; double radiusLng = dpmLng * raidusMile; double minLat = lat - radiusLng; double maxLat = lat + radiusLng; double dpmLat = 1 / degree; double radiusLat = dpmLat * raidusMile; double minLng = lng - radiusLat; double maxLng = lng + radiusLat; map.put("minLat", minLat); map.put("maxLat", maxLat); map.put("minLng", minLng); map.put("maxLng", maxLng); return map; } }
MapDistance { public static Map<String, Double> getAround(double lng, double lat, double raidusMile) { Map<String, Double> map = new HashMap<>(); double degree = (24901 * 1609) / 360.0; double mpdLng = Double.parseDouble((degree * Math.cos(lng * (Math.PI / 180)) + "").replace("-", "")); double dpmLng = 1 / mpdLng; double radiusLng = dpmLng * raidusMile; double minLat = lat - radiusLng; double maxLat = lat + radiusLng; double dpmLat = 1 / degree; double radiusLat = dpmLat * raidusMile; double minLng = lng - radiusLat; double maxLng = lng + radiusLat; map.put("minLat", minLat); map.put("maxLat", maxLat); map.put("minLng", minLng); map.put("maxLng", maxLng); return map; }  }
MapDistance { public static Map<String, Double> getAround(double lng, double lat, double raidusMile) { Map<String, Double> map = new HashMap<>(); double degree = (24901 * 1609) / 360.0; double mpdLng = Double.parseDouble((degree * Math.cos(lng * (Math.PI / 180)) + "").replace("-", "")); double dpmLng = 1 / mpdLng; double radiusLng = dpmLng * raidusMile; double minLat = lat - radiusLng; double maxLat = lat + radiusLng; double dpmLat = 1 / degree; double radiusLat = dpmLat * raidusMile; double minLng = lng - radiusLat; double maxLng = lng + radiusLat; map.put("minLat", minLat); map.put("maxLat", maxLat); map.put("minLng", minLng); map.put("maxLng", maxLng); return map; }  static double getDistance(double lng1, double lat1, double lng2, double lat2); static Map<String, Double> getAround(double lng, double lat, double raidusMile); }
MapDistance { public static Map<String, Double> getAround(double lng, double lat, double raidusMile) { Map<String, Double> map = new HashMap<>(); double degree = (24901 * 1609) / 360.0; double mpdLng = Double.parseDouble((degree * Math.cos(lng * (Math.PI / 180)) + "").replace("-", "")); double dpmLng = 1 / mpdLng; double radiusLng = dpmLng * raidusMile; double minLat = lat - radiusLng; double maxLat = lat + radiusLng; double dpmLat = 1 / degree; double radiusLat = dpmLat * raidusMile; double minLng = lng - radiusLat; double maxLng = lng + radiusLat; map.put("minLat", minLat); map.put("maxLat", maxLat); map.put("minLng", minLng); map.put("maxLng", maxLng); return map; }  static double getDistance(double lng1, double lat1, double lng2, double lat2); static Map<String, Double> getAround(double lng, double lat, double raidusMile); static final double EARTH_RADIUS; }