[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 11:22:29 -0600


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) {

like so:

                while (snorthing.length() > 6) {

                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 - 13:48:55 EDT

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