joelmap / geohashdroid

Automatically exported from code.google.com/p/geohashdroid
0 stars 0 forks source link

coordinate display as minutes or seconds is broken #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Switching to dd°mm.mm or dd°mm'ss"

What is the expected output? What do you see instead?
Displays ???N ???E for target and current coordinates.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by thomas.h...@gmail.com on 6 Aug 2010 at 12:05

GoogleCodeExporter commented 9 years ago
Hm... I'll have to check this out when I get back home.  It'll say "???" for 
the coordinates if it can't figure out what your coordinate format setting is 
(it was either that or crash), so I know what's going on, but I can't seem to 
reproduce it on my phone.  But, I've got newer code on mine right now, so maybe 
it's something that slipped into the 0.7.5 release that I fixed since then.

Original comment by captains...@gmail.com on 6 Aug 2010 at 2:58

GoogleCodeExporter commented 9 years ago
Actually, I just had an idea.  Can you get a log output from any point after it 
gives you "???" for the coordinates?  If it gives you an error with the debug 
tag "UnitConverter" that starts with "Exception thrown during coordinate 
conversion", that could help quite a bit.  I forgot that it'll also give "???" 
as a result if there's any sort of exception when converting the units from 
degrees to minutes/seconds.

Original comment by captains...@gmail.com on 6 Aug 2010 at 4:32

GoogleCodeExporter commented 9 years ago
You were right - here's the log.

The coordinates are displayed in normal mode as "59,8751°N" (sic: with comma!) 
if that matters. Could be an issue with the German locale.

08-06 18:42:36.001: ERROR/UnitConverter(11285): Exception thrown during 
coordinate conversion: java.lang.NumberFormatException: 
08-06 18:42:36.001: WARN/System.err(11285): java.lang.NumberFormatException: 
08-06 18:42:36.001: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDblImpl(Native Method)
08-06 18:42:36.011: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser
.java:274)
08-06 18:42:36.011: WARN/System.err(11285):     at 
java.lang.Double.parseDouble(Double.java:323)
08-06 18:42:36.011: WARN/System.err(11285):     at 
java.lang.Double.<init>(Double.java:117)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeCoordinateString(UnitConver
ter.java:214)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeLatitudeCoordinateString(Un
itConverter.java:136)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMapJumboInfoBoxView.update(MainMapJumboIn
foBoxView.java:101)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.populateInfoBox(MainMap.java:885)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.access$4(MainMap.java:873)
08-06 18:42:36.011: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap$AutoZoomingLocationOverlayHandler.han
dleMessage(MainMap.java:937)
08-06 18:42:36.011: WARN/System.err(11285):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
08-06 18:42:36.021: WARN/System.err(11285):     at 
android.os.Looper.loop(Looper.java:123)
08-06 18:42:36.021: WARN/System.err(11285):     at 
android.app.ActivityThread.main(ActivityThread.java:4203)
08-06 18:42:36.021: WARN/System.err(11285):     at 
java.lang.reflect.Method.invokeNative(Native Method)
08-06 18:42:36.021: WARN/System.err(11285):     at 
java.lang.reflect.Method.invoke(Method.java:521)
08-06 18:42:36.021: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-06 18:42:36.021: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-06 18:42:36.021: WARN/System.err(11285):     at 
dalvik.system.NativeStart.main(Native Method)
08-06 18:42:36.031: ERROR/UnitConverter(11285): Exception thrown during 
coordinate conversion: java.lang.NumberFormatException: 
08-06 18:42:36.031: WARN/System.err(11285): java.lang.NumberFormatException: 
08-06 18:42:36.041: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDblImpl(Native Method)
08-06 18:42:36.041: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser
.java:274)
08-06 18:42:36.041: WARN/System.err(11285):     at 
java.lang.Double.parseDouble(Double.java:323)
08-06 18:42:36.041: WARN/System.err(11285):     at 
java.lang.Double.<init>(Double.java:117)
08-06 18:42:36.041: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeCoordinateString(UnitConver
ter.java:214)
08-06 18:42:36.041: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeLongitudeCoordinateString(U
nitConverter.java:178)
08-06 18:42:36.041: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMapJumboInfoBoxView.update(MainMapJumboIn
foBoxView.java:102)
08-06 18:42:36.041: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.populateInfoBox(MainMap.java:885)
08-06 18:42:36.051: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.access$4(MainMap.java:873)
08-06 18:42:36.051: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap$AutoZoomingLocationOverlayHandler.han
dleMessage(MainMap.java:937)
08-06 18:42:36.051: WARN/System.err(11285):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
08-06 18:42:36.051: WARN/System.err(11285):     at 
android.os.Looper.loop(Looper.java:123)
08-06 18:42:36.051: WARN/System.err(11285):     at 
android.app.ActivityThread.main(ActivityThread.java:4203)
08-06 18:42:36.051: WARN/System.err(11285):     at 
java.lang.reflect.Method.invokeNative(Native Method)
08-06 18:42:36.051: WARN/System.err(11285):     at 
java.lang.reflect.Method.invoke(Method.java:521)
08-06 18:42:36.051: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-06 18:42:36.051: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-06 18:42:36.061: WARN/System.err(11285):     at 
dalvik.system.NativeStart.main(Native Method)
08-06 18:42:36.071: ERROR/UnitConverter(11285): Exception thrown during 
coordinate conversion: java.lang.NumberFormatException: 
08-06 18:42:36.071: WARN/System.err(11285): java.lang.NumberFormatException: 
08-06 18:42:36.071: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDblImpl(Native Method)
08-06 18:42:36.071: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser
.java:274)
08-06 18:42:36.071: WARN/System.err(11285):     at 
java.lang.Double.parseDouble(Double.java:323)
08-06 18:42:36.071: WARN/System.err(11285):     at 
java.lang.Double.<init>(Double.java:117)
08-06 18:42:36.071: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeCoordinateString(UnitConver
ter.java:214)
08-06 18:42:36.081: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeLatitudeCoordinateString(Un
itConverter.java:136)
08-06 18:42:36.081: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMapJumboInfoBoxView.update(MainMapJumboIn
foBoxView.java:108)
08-06 18:42:36.081: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.populateInfoBox(MainMap.java:885)
08-06 18:42:36.081: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.access$4(MainMap.java:873)
08-06 18:42:36.081: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap$AutoZoomingLocationOverlayHandler.han
dleMessage(MainMap.java:937)
08-06 18:42:36.081: WARN/System.err(11285):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
08-06 18:42:36.081: WARN/System.err(11285):     at 
android.os.Looper.loop(Looper.java:123)
08-06 18:42:36.081: WARN/System.err(11285):     at 
android.app.ActivityThread.main(ActivityThread.java:4203)
08-06 18:42:36.081: WARN/System.err(11285):     at 
java.lang.reflect.Method.invokeNative(Native Method)
08-06 18:42:36.081: WARN/System.err(11285):     at 
java.lang.reflect.Method.invoke(Method.java:521)
08-06 18:42:36.081: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-06 18:42:36.091: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-06 18:42:36.091: WARN/System.err(11285):     at 
dalvik.system.NativeStart.main(Native Method)
08-06 18:42:36.101: ERROR/UnitConverter(11285): Exception thrown during 
coordinate conversion: java.lang.NumberFormatException: 
08-06 18:42:36.101: WARN/System.err(11285): java.lang.NumberFormatException: 
08-06 18:42:36.101: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDblImpl(Native Method)
08-06 18:42:36.101: WARN/System.err(11285):     at 
org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser
.java:274)
08-06 18:42:36.101: WARN/System.err(11285):     at 
java.lang.Double.parseDouble(Double.java:323)
08-06 18:42:36.101: WARN/System.err(11285):     at 
java.lang.Double.<init>(Double.java:117)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeCoordinateString(UnitConver
ter.java:214)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.UnitConverter.makeLongitudeCoordinateString(U
nitConverter.java:178)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMapJumboInfoBoxView.update(MainMapJumboIn
foBoxView.java:109)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.populateInfoBox(MainMap.java:885)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap.access$4(MainMap.java:873)
08-06 18:42:36.111: WARN/System.err(11285):     at 
net.exclaimindustries.geohashdroid.MainMap$AutoZoomingLocationOverlayHandler.han
dleMessage(MainMap.java:937)
08-06 18:42:36.111: WARN/System.err(11285):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
08-06 18:42:36.111: WARN/System.err(11285):     at 
android.os.Looper.loop(Looper.java:123)
08-06 18:42:36.111: WARN/System.err(11285):     at 
android.app.ActivityThread.main(ActivityThread.java:4203)
08-06 18:42:36.121: WARN/System.err(11285):     at 
java.lang.reflect.Method.invokeNative(Native Method)
08-06 18:42:36.121: WARN/System.err(11285):     at 
java.lang.reflect.Method.invoke(Method.java:521)
08-06 18:42:36.121: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-06 18:42:36.121: WARN/System.err(11285):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-06 18:42:36.121: WARN/System.err(11285):     at 
dalvik.system.NativeStart.main(Native Method)

Original comment by thomas.h...@gmail.com on 6 Aug 2010 at 4:46

GoogleCodeExporter commented 9 years ago
Huh, that's sort of odd.  I thought Java automatically knew what to do with 
locales and things like that.

Though I think I see what could be causing it.  I'll have to see what 
Location.convert returns when dealing with minutes/seconds with a decimal in 
them.  It could be that it's always returning a period for the separator 
regardless of locale, and the subsequent Double(minutes).doubleValue() is 
getting confused because it's looking for the CORRECT separator.

If that IS what's going on, I'd call that an Android bug, one which I can 
submit a patch for.  Though I'd still need to work around it, definitely.  I'll 
look into it when I get home, since I'd rather have my test phone or an 
emulator to start changing the locale for test purposes. :-)

I'm a bit embarrassed, I'm usually better with catching locale-based nuances... 
:-)

Original comment by captains...@gmail.com on 6 Aug 2010 at 4:56

GoogleCodeExporter commented 9 years ago
Yep, that did the trick.  r477 (in the 0.7.4-backports branch) has the fix.  I 
was counting on the Double class to be able to parse the output from a piece of 
Location.convert().  Since Location.convert() always gives the fractional part 
of the location with a period, and since Double's constructor strictly looks at 
the current locale to convert, it was confusing it.  NumberFormat's parser 
(which defaults to DecimalFormat) is a lot more robust, and that fixed it.

Note that right now, r477 isn't entirely usable yet.  I'm working on redoing 
the image uploading part and it won't upload just yet.  So be warned.

Oh, and one other thing.  I was having a hard time getting a clear answer for 
this, but in locales where the comma is used as the separator for the decimal 
portion of a number, does that carry through to geographic coordinates, or is 
that an exception?

Original comment by captains...@gmail.com on 7 Aug 2010 at 1:01

GoogleCodeExporter commented 9 years ago
I have been wondering about that too. I have been so used to seeing GPS 
coordinates in English localization that the comma caught my eye immediately. 
But looking at some German sources I can definitely confirm that the comma is 
used to delimit decimals, just as well in coordinates. (The decimal form is a 
lot less common outside the world of GPS, as you would traditionally give them 
in full degrees, minutes and seconds.) 

Original comment by thomas.h...@gmail.com on 7 Aug 2010 at 7:39

GoogleCodeExporter commented 9 years ago
Ah, good.  I'll keep it displaying whatever's properly localized, then.

Well, I've got the fix in, as I said.  I would make a package for testing, but 
I'm a bit held up with an OutOfMemoryError with the new wiki picture uploader 
interface.  Once I've got that taken care of, I should have something up.

Original comment by captains...@gmail.com on 10 Aug 2010 at 10:19

GoogleCodeExporter commented 9 years ago
There.  That oughta do it.  Version 0.7.7-pre1 is now up on the site.  It 
should fix the coordinate display problem.  Enjoy!

Original comment by captains...@gmail.com on 12 Aug 2010 at 1:26

GoogleCodeExporter commented 9 years ago
Version 0.7.7 is out in the Marketplace, and that ought to fix the issue 
entirely.

Original comment by captains...@gmail.com on 17 Aug 2010 at 6:10

GoogleCodeExporter commented 9 years ago
Confirmed. :)

Original comment by thomas.h...@gmail.com on 17 Aug 2010 at 8:44

GoogleCodeExporter commented 9 years ago
Just wondering... should the jumbo sized infobox not also display the distance? 
That's about the most important display of the three when you're out there.

Original comment by thomas.h...@gmail.com on 17 Aug 2010 at 8:45

GoogleCodeExporter commented 9 years ago
I decided against showing distance with the jumbo sized infobox because with 
the third line and the large font size, it was taking up an awful lot of the 
map display (especially in landscape mode).  Though you're right, that is a bit 
important as you get closer in.  Would it make more sense to remove one of the 
other lines (final destination or your current location) to make room for it?

Original comment by captains...@gmail.com on 17 Aug 2010 at 9:30

GoogleCodeExporter commented 9 years ago
I would remove "final destination". It does not change, you can still view it 
on the info panel, and you don't need it for proof pictures either. 

Original comment by thomas.h...@gmail.com on 17 Aug 2010 at 10:51

GoogleCodeExporter commented 9 years ago
There we go.  As per r493, I've changed it so that the distance is displayed 
instead of the final destination's coordinates in jumbo mode.  Enjoy!

Original comment by captains...@gmail.com on 18 Aug 2010 at 11:47

GoogleCodeExporter commented 9 years ago
Yay!

Original comment by thomas.h...@gmail.com on 19 Aug 2010 at 7:04