[josm-dev] GPS coordinates

Ævar Arnfjörð Bjarmason avarab at gmail.com
Sat Nov 29 18:31:46 GMT 2008


On Sat, Nov 29, 2008 at 3:18 PM, Markus Lindholm
<markus.lindholm at gmail.com> wrote:
> Ok, attached a patch to ticket
> http://josm.openstreetmap.de/ticket/1730

[I'm not a JOSM dev]

I reviewed it briefly and there are a few problems I can see:

* The string you're writing to the preferences file to determine what
coordinate system the user wants is the one displayed in the user
interface, thus if you ever change the UI string (or it gets
translated?) the preference will break. It would be better to write
something like "coordinates=DMS" than "coordinates=Degree Minute
Second"

* Your convertDDToDMS() function breaks if either of the degrees is
negative, e.g. -21.5050 will be -21°-30'-30 (approx values), you need
to import java.lang.Math and do something like:

    public static String S(double pCordinate) {

        int tDegree = (int) pCordinate;
        double tTmpMinutes = (pCordinate - tDegree) * 60;
        int tMinutes = Math.abs((int) tTmpMinutes);
        double tSeconds = Math.abs((tTmpMinutes - tMinutes) * 60);

        return tDegree + "\u00B0" + tMinutes + "\'" +
DMSsFormatter.format(tSeconds) + "\"";

* Your DMS format isn't a DMS format at all even without the negative
values in the middle of the string. There are no negative numbers in
DMS, 64,-21 is 64N,21W

* This only works for the JOSM map display but not other places where
coordinates are displayed, e.g. the selection dialog

* The width of the coordinate display needs to be adjusted depending
on the coordinate system in use or trailing dots will be displayed
(see attached screenshot)

And as a bit of random drive-by bikeshedding I prefer the Garmin
coordinate selection format I've attached in my patch, which is broken
by default unless you select a coordinate system since I was in the
process of trying to add a DM system in addition do D and DMS.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avar-coordinate-display.patch
Type: text/x-diff
Size: 8344 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20081129/0090ecb0/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-Java OpenStreetMap - Editor.png
Type: image/png
Size: 2170 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20081129/0090ecb0/attachment.png>


More information about the josm-dev mailing list