RE: [OpenMap Users] MGRSPoint.getMGRS() incorrect for points just north of the equator

From: Chase Barrett <chase.barrett_at_issinc.com>
Date: Thu, 25 Oct 2007 12:02:22 -0600

Oops! Make that MGRSPoint.getMGRS()

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On
Behalf Of Chase Barrett
Sent: Thursday, October 25, 2007 11:22 AM
To: 'openmap'
Subject: [OpenMap Users] MGRSPoint.getMGRS() incorrect for points just north
of the equator

All,

The MGRS.getMGRS() produces an incorrect string when the point is just north
of the equator (specifically when the northing is less than 100,000 meters),
and when the point's accuracy is anything other than 1m.

The following table is sample output from the attached source. The 1m
accuracy produces the correct string, but every other accuracy is incorrect
in the northing value:

  1m accuracy: 38NNF0000012345
  10m accuracy: 38NNF00002345
  100m accuracy: 38NNF000234
  1km accuracy: 38NNF0023
  10km accuracy: 38NNF02

This is what you should see:

  1m accuracy: 38NNF0000012345
  10m accuracy: 38NNF00001234
  100m accuracy: 38NNF000123
  1km accuracy: 38NNF0012
  10km accuracy: 38NNF01

The fix we've implemented is pretty painless. At line 523 in the
MGRSPoint.resolve() method, augment the following while loop:

                while (snorthing.length() > 6) {
                    snorthing.deleteCharAt(0);
                }

like so:

                while (snorthing.length() > 6) {
                    snorthing.deleteCharAt(0);
                }

                while (snorthing.length() < 6) {
                    snorthing.insert(0, '0');
                }

- Chase


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Oct 25 2007 - 14:03:06 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT