Package mil.nga.gars

Class GARSUtils


  • public class GARSUtils
    extends Object
    Global Area Reference System utilities
    Author:
    osbornb
    • Constructor Summary

      Constructors 
      Constructor Description
      GARSUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static char bandLetter​(int bandValue)
      Get the latitude character equivalent from the band number (where 1 is A and 24 is Z)
      static String bandLetters​(int bandValue)
      Get the latitude band from the band number (where 1 is AA and 360 is QZ)
      static int bandValue​(char latitudeBand)
      Get the latitude character band number equivalent (where A is 1 and Z is 24)
      static int bandValue​(String latitudeBand)
      Get the latitude band number equivalent to the longitude band (where AA is 1 and QZ is 360)
      static BandLettersRange getBandLettersRange​(double south, double north)
      Get a band letters range between the southern and northern latitudes in degrees
      static BandLettersRange getBandLettersRange​(Bounds bounds)
      Get a band letters range between the southern and northern bounds
      static BandNumberRange getBandNumberRange​(double west, double east)
      Get a band number range between the western and eastern longitudes
      static BandNumberRange getBandNumberRange​(Bounds bounds)
      Get a band number range between the western and eastern bounds
      static String getDegreeLabel​(double longitude, double latitude)
      Create a degree grid label
      static GridRange getGridRange​(Bounds bounds)
      Get a grid range from the bounds
      static double getLatitude​(int band)
      Get the latitude from the latitude band letters number equivalent
      static double getLatitude​(String band)
      Get the latitude from the latitude band letters
      static String getLatitudeBand​(double latitude)
      Get the latitude band letters from the latitude
      static int getLatitudeBandValue​(double latitude)
      Get the latitude band value from the latitude
      static double getLatitudeDecimalBandValue​(double latitude)
      Get the latitude decimal band value from the latitude
      static double getLongitude​(int band)
      Get the longitude from the longitude band
      static int getLongitudeBand​(double longitude)
      Get the longitude band from the longitude
      static double getLongitudeDecimalBand​(double longitude)
      Get the longitude decimal band from the longitude
      static int keypad​(int column, int row)
      Get the keypad from the southwest origin 0 indexed column and row
      static int keypadColumn​(int keypad)
      Get the keypad southwest origin 0 indexed column
      static int keypadRow​(int keypad)
      Get the keypad southwest origin 0 indexed row
      static double nextPrecision​(double value, double precision)
      Get the next precision value from the precision value and precision
      static int quadrant​(int column, int row)
      Get the quadrant from the southwest origin 0 indexed column and row
      static int quadrantColumn​(int quadrant)
      Get the quadrant southwest origin 0 indexed column
      static int quadrantRow​(int quadrant)
      Get the quadrant southwest origin 0 indexed row
    • Constructor Detail

      • GARSUtils

        public GARSUtils()
    • Method Detail

      • getLongitude

        public static double getLongitude​(int band)
        Get the longitude from the longitude band
        Parameters:
        band - longitudinal band number
        Returns:
        longitude
      • getLatitude

        public static double getLatitude​(String band)
        Get the latitude from the latitude band letters
        Parameters:
        band - latitudinal band letters
        Returns:
        latitude
      • getLatitude

        public static double getLatitude​(int band)
        Get the latitude from the latitude band letters number equivalent
        Parameters:
        band - latitudinal band number
        Returns:
        latitude
      • getLongitudeBand

        public static int getLongitudeBand​(double longitude)
        Get the longitude band from the longitude
        Parameters:
        longitude - longitude
        Returns:
        longitude band
      • getLongitudeDecimalBand

        public static double getLongitudeDecimalBand​(double longitude)
        Get the longitude decimal band from the longitude
        Parameters:
        longitude - longitude
        Returns:
        longitude decimal band
      • getLatitudeBand

        public static String getLatitudeBand​(double latitude)
        Get the latitude band letters from the latitude
        Parameters:
        latitude - latitude
        Returns:
        latitude band letters
      • getLatitudeBandValue

        public static int getLatitudeBandValue​(double latitude)
        Get the latitude band value from the latitude
        Parameters:
        latitude - latitude
        Returns:
        latitude band value
      • getLatitudeDecimalBandValue

        public static double getLatitudeDecimalBandValue​(double latitude)
        Get the latitude decimal band value from the latitude
        Parameters:
        latitude - latitude
        Returns:
        latitude decimal band value
      • bandValue

        public static int bandValue​(String latitudeBand)
        Get the latitude band number equivalent to the longitude band (where AA is 1 and QZ is 360)
        Parameters:
        latitudeBand - two character latitude band
        Returns:
        number band value
      • bandValue

        public static int bandValue​(char latitudeBand)
        Get the latitude character band number equivalent (where A is 1 and Z is 24)
        Parameters:
        latitudeBand - single character from latitude band
        Returns:
        number band value
      • bandLetters

        public static String bandLetters​(int bandValue)
        Get the latitude band from the band number (where 1 is AA and 360 is QZ)
        Parameters:
        bandValue - number band value
        Returns:
        two character latitude band
      • bandLetter

        public static char bandLetter​(int bandValue)
        Get the latitude character equivalent from the band number (where 1 is A and 24 is Z)
        Parameters:
        bandValue - number band value
        Returns:
        single character of latitude band
      • quadrantColumn

        public static int quadrantColumn​(int quadrant)
        Get the quadrant southwest origin 0 indexed column
        Parameters:
        quadrant - quadrant number
        Returns:
        0 for quadrants 1|3, 1 for quadrants 2|4
      • quadrantRow

        public static int quadrantRow​(int quadrant)
        Get the quadrant southwest origin 0 indexed row
        Parameters:
        quadrant - quadrant number
        Returns:
        0 for quadrants 3|4, 1 for quadrants 1|2
      • keypadColumn

        public static int keypadColumn​(int keypad)
        Get the keypad southwest origin 0 indexed column
        Parameters:
        keypad - keypad number
        Returns:
        0 for keypads 1|4|7, 1 for keypads 2|5|8, 2 for keypads 3|6|9
      • keypadRow

        public static int keypadRow​(int keypad)
        Get the keypad southwest origin 0 indexed row
        Parameters:
        keypad - keypad number
        Returns:
        0 for keypads 7|8|9, 1 for keypads 4|5|6, 2 for keypads 1|2|3
      • quadrant

        public static int quadrant​(int column,
                                   int row)
        Get the quadrant from the southwest origin 0 indexed column and row
        Parameters:
        column - 0 indexed column
        row - 0 indexed row
        Returns:
        quadrant
      • keypad

        public static int keypad​(int column,
                                 int row)
        Get the keypad from the southwest origin 0 indexed column and row
        Parameters:
        column - 0 indexed column
        row - 0 indexed row
        Returns:
        keypad
      • getGridRange

        public static GridRange getGridRange​(Bounds bounds)
        Get a grid range from the bounds
        Parameters:
        bounds - bounds
        Returns:
        grid range
      • getBandNumberRange

        public static BandNumberRange getBandNumberRange​(Bounds bounds)
        Get a band number range between the western and eastern bounds
        Parameters:
        bounds - bounds
        Returns:
        band number range
      • getBandNumberRange

        public static BandNumberRange getBandNumberRange​(double west,
                                                         double east)
        Get a band number range between the western and eastern longitudes
        Parameters:
        west - western longitude in degrees
        east - eastern longitude in degrees
        Returns:
        band number range
      • getBandLettersRange

        public static BandLettersRange getBandLettersRange​(Bounds bounds)
        Get a band letters range between the southern and northern bounds
        Parameters:
        bounds - bounds
        Returns:
        band letters range
      • getBandLettersRange

        public static BandLettersRange getBandLettersRange​(double south,
                                                           double north)
        Get a band letters range between the southern and northern latitudes in degrees
        Parameters:
        south - southern latitude in degrees
        north - northern latitude in degrees
        Returns:
        band letters range
      • getDegreeLabel

        public static String getDegreeLabel​(double longitude,
                                            double latitude)
        Create a degree grid label
        Parameters:
        longitude - longitude
        latitude - latitude
        Returns:
        degree label
      • nextPrecision

        public static double nextPrecision​(double value,
                                           double precision)
        Get the next precision value from the precision value and precision
        Parameters:
        value - precision value
        precision - grid precision
        Returns:
        next precision value