Class PrecisionScales


  • public class PrecisionScales
    extends java.lang.Object
    Author:
    ubaldino
    • Constructor Summary

      Constructors 
      Constructor Description
      PrecisionScales()  
    • Method Summary

      Modifier and Type Method Description
      static int count_DD_digits​(java.lang.String lat)
      Count the number of decimal places in a lat or lon text string.
      static int count_DMS_digits​(java.lang.String lat)
      Counts all digits in latitude.
      static java.lang.String format​(double f, int digits)
      This was deemed to be more Java like, however performs 10x slower than format2() -- which unfortunately rounds too early.
      static GeocoordPrecision getDDPrecision​(java.lang.String lat)
      Return XCoord precision (+/- meters) in latitude.
      static void setDDPrecision​(GeocoordMatch m)
      Sets the precision on a decimal degrees match
      static void setDMSPrecision​(GeocoordMatch m)
      set precision on a DMS text coordinate -- simply if the Match latitude "has seconds" then its precision is seconds, otherwise if it has minutes, then it is precise to +/- 1 minute, etc.
      static void setMGRSPrecision​(GeocoordMatch m)  
      static void setUTMPrecision​(GeocoordMatch m)  
      static float UTM_precision​(java.lang.String utm)
      For now default UTM precision to +/- 100m
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_UNKNOWN_RESOLUTION

        public static final float DEFAULT_UNKNOWN_RESOLUTION
        See Also:
        Constant Field Values
      • DD_precision_list

        public static final double[] DD_precision_list
        Maximal error in METERS in coordinate with N decimal places; for up to 12 decimal places.
      • DMS_MIN_PREC

        public static float DMS_MIN_PREC
      • DMS_SEC_PREC

        public static float DMS_SEC_PREC
      • MGRS_precision_list

        public static float[] MGRS_precision_list
        Precision appears in pairs, as we tolerate some typo/errors in MGRs.
      • MGRS_offset_precision_list

        public static float[] MGRS_offset_precision_list
      • MGRS2DEC_digits

        public static int[] MGRS2DEC_digits
    • Constructor Detail

      • PrecisionScales

        public PrecisionScales()
    • Method Detail

      • setDDPrecision

        public static void setDDPrecision​(GeocoordMatch m)
        Sets the precision on a decimal degrees match
        Parameters:
        m - given match
      • getDDPrecision

        public static GeocoordPrecision getDDPrecision​(java.lang.String lat)
        Return XCoord precision (+/- meters) in latitude.
        Parameters:
        lat - string representing latitude
        Returns:
        precision
      • count_DD_digits

        public static int count_DD_digits​(java.lang.String lat)
        Count the number of decimal places in a lat or lon text string.
        Parameters:
        lat - string representing latitude
        Returns:
        number of digits in lat, as a proxy for precision
      • count_DMS_digits

        public static int count_DMS_digits​(java.lang.String lat)
        Counts all digits in latitude.
        Parameters:
        lat - string representing latitude
        Returns:
        number of digits in lat as a proxy for precision
      • setDMSPrecision

        public static void setDMSPrecision​(GeocoordMatch m)
        set precision on a DMS text coordinate -- simply if the Match latitude "has seconds" then its precision is seconds, otherwise if it has minutes, then it is precise to +/- 1 minute, etc. Default precision is half-degree ~ +/- 55KM. Prior implementation was based on digit counting, whereas with decimal degrees you must count digits to infer precision.
        Parameters:
        m - DMS match
      • setMGRSPrecision

        public static void setMGRSPrecision​(GeocoordMatch m)
        Parameters:
        m - MGRS match
      • setUTMPrecision

        public static void setUTMPrecision​(GeocoordMatch m)
        Parameters:
        m - UTM match
      • UTM_precision

        public static float UTM_precision​(java.lang.String utm)
        For now default UTM precision to +/- 100m
        Parameters:
        utm - UTM string
        Returns:
        precision
      • format

        public static java.lang.String format​(double f,
                                              int digits)
        This was deemed to be more Java like, however performs 10x slower than format2() -- which unfortunately rounds too early.
        Parameters:
        f - value
        digits - digits to include in format
        Returns:
        formatted value.