package osm.jp.api; public class Japan { public double minLat; // 緯度 public double maxLat; // 緯度 public double minLon; // 経度 public double maxLon; // 経度 public static String[] areaArgs = {"全国","北海道","青森県","岩手県","宮城県","秋田県","山形県","福島県","茨城県","栃木県","群馬県","埼玉県","千葉県","東京都","神奈川県","新潟県","富山県","石川県","福井県","山梨県","長野県","岐阜県","静岡県","愛知県","三重県","滋賀県","京都府","大阪府","兵庫県","奈良県","和歌山県","鳥取県","島根県","岡山県","広島県","山口県","徳島県","香川県","愛媛県","高知県","福岡県","佐賀県","長崎県","熊本県","大分県","宮崎県","鹿児島県","沖縄県"}; public static final double ONE_KM_LAT = 0.009013372D; // 1km距離を表す緯度(差分) public static final double ONE_KM_LON = 0.010966404D; // 1km距離を表す経度(差分) static final double BIG_Y = (40000.0d / 2.0d / Math.PI); // 地球の半径(km) static final double LAT1KM = (10000.0d / 90.0d); // 緯度1度の距離(km) static final double KM_LAT = (90.0d / 10000.0d); // 1km距離を表す緯度数 /** * 二点間の距離を取得する(単位:km) * * @param lat1 * @param lon1 * @param lat2 * @param lon2 * @return */ public static double distanceKm(double lat1, double lon1, double lat2, double lon2) { double lat = (lat1 + lat2) / 2; double y = Math.cos(Math.toRadians(lat)) * BIG_Y; // 緯線上の地球の半径(km) double LON1KM = (y * 2.0d * Math.PI) / 360.0d; // 緯線上の経度1度の距離(km) double KM_LON = 1 / LON1KM; // 緯線上の1km距離を表す経度 /* double dLon = m / lon1; // 距離を表す経度(差分) double dLat = m / LAT1KM; // 距離を表す緯度(差分) double dlat = Math.abs(lat1 - lat2) / Japan.ONE_KM_LAT; double dlon = Math.abs(lon1 - lon2) / Japan.ONE_KM_LON; */ double dlat = Math.abs(lat1 - lat2) / KM_LAT; double dlon = Math.abs(lon1 - lon2) / KM_LON; return Math.sqrt(Math.pow(dlat,2) + Math.pow(dlon,2)); } public Japan(double minLon, double minLat, double delta) { this.minLat = minLat; this.maxLat = minLat + delta; this.minLon = minLon; this.maxLon = minLon + delta; } public String getSNWE() { return (this.minLat +","+ this.maxLat +","+ this.minLon +","+ this.maxLon); } public String getSWNE() { return (this.minLat +","+ this.minLon +","+ this.maxLat +","+ this.maxLon); } public static Japan[] all = new Japan[] { new Japan(140D, 45D, 1D), new Japan(141D, 45D, 1D), new Japan(142D, 45D, 1D), new Japan(140D, 44D, 1D), new Japan(141D, 44D, 1D), new Japan(142D, 44D, 1D), new Japan(143D, 44D, 1D), new Japan(144D, 44D, 1D), new Japan(145D, 44D, 1D), new Japan(140D, 43D, 1D), new Japan(141D, 43D, 1D), new Japan(142D, 43D, 1D), new Japan(143D, 43D, 1D), new Japan(144D, 43D, 1D), new Japan(145D, 43D, 1D), new Japan(139D, 42D, 1D), new Japan(140D, 42D, 1D), new Japan(141D, 42D, 1D), new Japan(142D, 42D, 1D), new Japan(143D, 42D, 1D), new Japan(144D, 42D, 1D), new Japan(145D, 42D, 1D), new Japan(139D, 41D, 1D), new Japan(140D, 41D, 1D), new Japan(141D, 41D, 1D), new Japan(139D, 40D, 1D), new Japan(140D, 40D, 1D), new Japan(141D, 40D, 1D), new Japan(139D, 39D, 1D), new Japan(140D, 39D, 1D), new Japan(141D, 39D, 1D), new Japan(142D, 39D, 1D), new Japan(138D, 38D, 1D), new Japan(139D, 38D, 1D), new Japan(140D, 38D, 1D), new Japan(141D, 38D, 1D), new Japan(136D, 37D, 1D), new Japan(137D, 37D, 1D), new Japan(138D, 37D, 1D), new Japan(139D, 37D, 1D), new Japan(140D, 37D, 1D), new Japan(141D, 37D, 1D), new Japan(132D, 36D, 1D), new Japan(133D, 36D, 1D), new Japan(135D, 36D, 1D), new Japan(136D, 36D, 1D), new Japan(137D, 36D, 1D), new Japan(138D, 36D, 1D), new Japan(139D, 36D, 1D), new Japan(140D, 36D, 1D), new Japan(132D, 35D, 1D), new Japan(133D, 35D, 1D), new Japan(134D, 35D, 1D), new Japan(135D, 35D, 1D), new Japan(136D, 35D, 1D), new Japan(137D, 35D, 1D), new Japan(138D, 35D, 1D), new Japan(139D, 35D, 1D), new Japan(140D, 35D, 1D), new Japan(129D, 34D, 1D), new Japan(130D, 34D, 1D), new Japan(131D, 34D, 1D), new Japan(132D, 34D, 1D), new Japan(133D, 34D, 1D), new Japan(134D, 34D, 1D), new Japan(135D, 34D, 1D), new Japan(136D, 34D, 1D), new Japan(137D, 34D, 1D), new Japan(138D, 34D, 1D), new Japan(139D, 34D, 1D), new Japan(129D, 33D, 1D), new Japan(130D, 33D, 1D), new Japan(131D, 33D, 1D), new Japan(132D, 33D, 1D), new Japan(133D, 33D, 1D), new Japan(134D, 33D, 1D), new Japan(135D, 33D, 1D), new Japan(136D, 33D, 1D), new Japan(139D, 33D, 1D), new Japan(128D, 32D, 1D), new Japan(129D, 32D, 1D), new Japan(130D, 32D, 1D), new Japan(131D, 32D, 1D), new Japan(132D, 32D, 1D), new Japan(133D, 32D, 1D), new Japan(139D, 32D, 1D), new Japan(129D, 31D, 1D), new Japan(130D, 31D, 1D), new Japan(131D, 31D, 1D), new Japan(129D, 30D, 1D), new Japan(130D, 30D, 1D), new Japan(131D, 30D, 1D), new Japan(128D, 29D, 1D), new Japan(129D, 29D, 1D), new Japan(128D, 28D, 1D), new Japan(129D, 28D, 1D), new Japan(127D, 27D, 1D), new Japan(128D, 27D, 1D), new Japan(129D, 27D, 1D), new Japan(126D, 26D, 1D), new Japan(127D, 26D, 1D), new Japan(128D, 26D, 1D), new Japan(129D, 26D, 1D), new Japan(125D, 25D, 1D), new Japan(123D, 24D, 1D), new Japan(124D, 24D, 1D), new Japan(125D, 24D, 1D), // 小笠原諸島 new Japan(142D, 27D, 1D), new Japan(142D, 26D, 1D) }; public static Japan[] all2 = new Japan[] { new Japan(123D, 24D, 1D), new Japan(124D, 24D, 2D), new Japan(126D, 26D, 2D), new Japan(128D, 26D, 2D), new Japan(128D, 28D, 2D), new Japan(128D, 30D, 2D), new Japan(128D, 32D, 2D), new Japan(129D, 34D, 1D), new Japan(130D, 30D, 2D), new Japan(130D, 32D, 2D), new Japan(130D, 34D, 2D), new Japan(132D, 32D, 2D), new Japan(132D, 34D, 2D), new Japan(132D, 36D, 2D), new Japan(134D, 32D, 2D), new Japan(134D, 34D, 2D), new Japan(135D, 36D, 1D), new Japan(136D, 33D, 1D), new Japan(136D, 34D, 2D), new Japan(136D, 36D, 2D), new Japan(138D, 32D, 2D), new Japan(138D, 34D, 2D), new Japan(138D, 36D, 2D), new Japan(138D, 38D, 2D), new Japan(138D, 40D, 2D), new Japan(139D, 42D, 1D), new Japan(140D, 35D, 1D), new Japan(140D, 36D, 2D), new Japan(140D, 38D, 2D), new Japan(140D, 40D, 2D), new Japan(140D, 42D, 2D), new Japan(140D, 44D, 2D), new Japan(142D, 39D, 1D), new Japan(142D, 42D, 2D), new Japan(142D, 44D, 2D), new Japan(144D, 42D, 2D), new Japan(144D, 44D, 2D), // 小笠原諸島 new Japan(142D, 26D, 2D) }; public static Japan[] all3 = new Japan[] { new Japan(123D, 22D, 3D), new Japan(123D, 25D, 3D), new Japan(126D, 25D, 3D), new Japan(126D, 28D, 3D), new Japan(126D, 31D, 3D), new Japan(129D, 25D, 3D), new Japan(129D, 28D, 3D), new Japan(129D, 31D, 3D), new Japan(129D, 34D, 3D), new Japan(132D, 31D, 3D), new Japan(132D, 34D, 3D), new Japan(135D, 31D, 3D), new Japan(135D, 34D, 3D), new Japan(135D, 37D, 3D), new Japan(138D, 31D, 3D), new Japan(138D, 34D, 3D), new Japan(138D, 37D, 3D), new Japan(138D, 40D, 3D), new Japan(138D, 43D, 3D), new Japan(141D, 37D, 3D), new Japan(141D, 40D, 3D), new Japan(141D, 43D, 3D), new Japan(144D, 43D, 3D), // 小笠原諸島 new Japan(141D, 25D, 3D) }; }