What steps will reproduce the problem?
1.
double lat = -77.9614596407155;
double lon = -139.96324813171648;
2. try to encode this to a string
3. try to decode the string to lat & lon
What is the expected output? What do you see instead?
The latter one is the difference.
-77.9614596407155:70.14700636267662
-139.96324813171648:-83.69167774915695
What version of the product are you using? On what operating system?
Vista/JDK 1.6
Please provide any additional information below.
Test code:
@Test
public void testEncode_Accuracy_Mistake() {
// -77.9614596407155:70.14700636267662
// -139.96324813171648:-83.69167774915695
double lat = -77.9614596407155;
double lon = -139.96324813171648;
String geohash = geohashUtil.encode(lat, lon);
Assert.assertNotNull(geohash);
double[] result = geohashUtil.decode(geohash);
if (Math.abs(lat - result[0]) > 0.00001
|| Math.abs(lon - result[1]) > 0.00001) {
System.out.println("============");
System.out.println(lat + ":" + result[0]);
System.out.println(lon + ":" + result[1]);
}
}
Original issue reported on code.google.com by
cnhapp...@gmail.comon 9 Jun 2011 at 3:54