jscience
  1. jscience
  2. JSCIENCE-143

Bug in method "getLatitudeZone(final LatLong latLong)" in class "UTM"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      143

      Description

      The method "getLatitudeZone(final LatLong latLong)" in the
      class "org.jscience.geography.coordinates.UTM" can sometimes return an
      incorrect latitude zone. When your latitude argument is negative, this will
      cause rounding errors, effectively pushing all the latitude zones on the
      southern hemisphere down one degree.

      Below is a suggestion to how the problem can be solved:

      public static char getLatitudeZone(final LatLong latLong) {
      if (isNorthPolar(latLong)) {
      if (latLong.longitudeValue(RADIAN) < 0)

      { return 'Y'; }

      else

      { return 'Z'; }

      }
      if (isSouthPolar(latLong)) {
      if (latLong.longitudeValue(RADIAN) < 0)

      { return 'A'; }

      else

      { return 'B'; }

      }

      final double degreesLatitude = latLong.latitudeValue(DEGREE_ANGLE);
      char zone = 'C';
      int latitudeZoneDegrees = -72;

      while(degreesLatitude >= latitudeZoneDegrees){
      latitudeZoneDegrees += 8;
      zone++;

      if(zone == 'I' || zone == 'O')

      { zone++; }

      if (zone > 'X')

      { zone = 'X'; }

      }

      return zone;
      }

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            dautelle
            Reporter:
            ottoheltne
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: