diff --git a/README.md b/README.md index 427b607..b0a017b 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ 地域メッシュコードを扱うライブラリ +``` + + + haya4.tools + haya4-jpmesh + 0.0.1 + +``` + ## See * [haya4-jpmesh wiki](http://surveyor.mydns.jp/gitbucket/haya4/haya4-jpmesh/wiki) diff --git a/src/main/java/haya4/tools/jpmesh/Jpmesh.java b/src/main/java/haya4/tools/jpmesh/Jpmesh.java index f93bc7e..4a37435 100644 --- a/src/main/java/haya4/tools/jpmesh/Jpmesh.java +++ b/src/main/java/haya4/tools/jpmesh/Jpmesh.java @@ -22,8 +22,8 @@ double lon2 = Double.parseDouble(str.substring(5, 6)); double lon3 = Double.parseDouble(str.substring(7, 8)); - double lat = (((lat1 / 1.5 * 3600) + (lat2 * 5 * 60) + (lat3 * 60)) / 3600); - double lon = ((((lon1 + 100) * 3600) + (lon2 * 7.5 * 60) + (lon3 * 45)) / 3600); + double lat = (((lat1 / 1.5 * 3600) + (lat2 * 300) + (lat3 * 30)) / 3600); + double lon = ((((lon1 + 100) * 3600) + (lon2 * 450) + (lon3 * 45)) / 3600); return new DirectPosition2D(lon, lat); } } @@ -38,8 +38,8 @@ public static DirectPosition2D getCenterPosition(String str) { DirectPosition2D ret = getPosition(str); if (ret != null) { - double lat = (ret.getY() + (30d / 2 / 3600d)); - double lon = (ret.getX() + (45d / 2 / 3600d)); + double lat = (ret.getY() + (15.0d / 3600.0d)); + double lon = (ret.getX() + (22.5d / 3600.0d)); return new DirectPosition2D(lon, lat); } return null; @@ -50,7 +50,7 @@ if (ret != null) { double lat = (ret.getY()); double lon = (ret.getX()); - return new Rectangle2D.Double(lon, lat, (45d / 3600d), (30d / 3600d)); + return new Rectangle2D.Double(lon, lat, 0.0125d, (30d / 3600d)); } return null; } diff --git a/src/main/java/haya4/tools/jpmesh/Position.java b/src/main/java/haya4/tools/jpmesh/Position.java deleted file mode 100644 index 67fea40..0000000 --- a/src/main/java/haya4/tools/jpmesh/Position.java +++ /dev/null @@ -1,25 +0,0 @@ -package haya4.tools.jpmesh; - -public class Position { - double lat = 0.0d; - double lon = 0.0d; - - public Position() { - this.lat = 0.0d; - this.lon = 0.0d; - } - - public Position(double lat, double lon) { - this.lat = lat; - this.lon = lon; - } - - public double getX() { - return this.lat; - } - - public double getY() { - return this.lon; - } - -} diff --git a/src/test/java/haya4/tools/jpmesh/JpmeshTest.java b/src/test/java/haya4/tools/jpmesh/JpmeshTest.java index 0542aaf..d0fc874 100755 --- a/src/test/java/haya4/tools/jpmesh/JpmeshTest.java +++ b/src/test/java/haya4/tools/jpmesh/JpmeshTest.java @@ -19,7 +19,7 @@ ret = Jpmesh.getPosition("53394526"); assertNotNull(ret); - assertEquals(35.7d, ret.getY(), 0.000001d); + assertEquals(35.683333d, ret.getY(), 0.000001d); assertEquals(139.7d, ret.getX(), 0.000001d); } @@ -27,7 +27,7 @@ public void getCenterTest() { DirectPosition2D center = Jpmesh.getCenterPosition("53394526"); assertNotNull(center); - assertEquals(35.7041666d, center.getY(), 0.000001d); + assertEquals(35.6875d, center.getY(), 0.000001d); assertEquals(139.70625d, center.getX(), 0.000001d); } @@ -35,7 +35,7 @@ public void getRectangleTest() { Rectangle2D rect = Jpmesh.getRectangle("53394526"); assertNotNull(rect); - assertEquals(35.7d, rect.getY(), 0.000001d); + assertEquals(35.683333d, rect.getY(), 0.000001d); assertEquals(139.7d, rect.getX(), 0.000001d); assertEquals(0.0083333d, rect.getHeight(), 0.000001d); assertEquals(0.0125, rect.getWidth(), 0.000001d);