[josm-dev] GPS coordinates

Markus Lindholm markus.lindholm at gmail.com
Sun Nov 30 14:06:36 GMT 2008


Hi

Thanks for the feedback. I've incorporated your changes and fixed
negative longitude and latitude so that in DMS N/S/W/E is displayed
instead. I've attached a new patch to the ticket
http://josm.openstreetmap.de/ticket/1730

It still only effects mapstatus and not selection though.

Regards
Markus

2008/11/29 Ævar Arnfjörð Bjarmason <avarab at gmail.com>:
> 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.
>


More information about the josm-dev mailing list