根据折线经纬度获取的折线平行线
/** * @Title: main * @Description: TODO(经纬度根据获取折线的平行线) * @param list 平行线 * @param angle (公里数)距离真实线范围 经纬度大概按照0.0011为100米进行计算 * @return List<Double[]> 平行线坐标数组{0:lon,1:lat} * @throws */ public static List<Double[]> getParallelLine(List<Map<String, Object>> list, double angle) { List<Double[]> listd = new ArrayList<>(); for (int i = 1; i < list.size() - 1; i++) { /*后一个点*/ Map<String, Object> map_1 = list.get(i + 1); Double[] result_1 = getTrueGrod(map_1); Double lon_1 = result_1[0]; Double lat_1 = result_1[1]; /*中间一个点*/ Map<String, Object> map = list.get(i); Double[] result = getTrueGrod(map); Double lon = result[0]; Double lat = result[1]; /*前一个点*/ Map<String, Object> map_2 = list.get(i - 1); Double[] result_2 = getTrueGrod(map_2); Double lon_2 = result_2[0]; Double lat_2 = result_2[1]; //System.out.println(angle * 1000 / 100 * 0.00105+"经纬度"); Double[] result_t = getResuleGrod(lon, lat, lon_1, lat_1, lon_2, lat_2, angle * 10 * 0.0011); listd.add(result_t); } return listd; } /** * @Title: getResuleGrod * @Description: TODO(根据三个点获取顶点经纬度位置) * @return Double[] * @throws */ private static Double[] getResuleGrod(double x, double y, double x1, double y1, double x2, double y2, double t) { if (y2 - y == 0 || y - y == 0) y = y - 0.0000001; double angle1 = Math.atan(x2 - x / y2 - y); double angle2 = Math.atan(x - x1 / y - y1); double angle3 = 0.5 * (angle2 - angle1 - Math.PI); double angle4 = angle1 + angle3; double distance = t / Math.sin(angle3); x = x + distance * Math.cos(angle4); y = y + distance * Math.sin(angle4); Double[] result = new Double[] { x , y }; return result; }