Class UnitsOfMeasure

  • All Implemented Interfaces:
    java.io.Serializable

    public class UnitsOfMeasure
    extends java.lang.Object
    implements java.io.Serializable
    Based on: http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html Based on: http://docs.opengeospatial.org/is/12-063r5/12-063r5.html Based on: https://sis.apache.org/apidocs/org/apache/sis/measure/Units.html
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      UnitsOfMeasure​(java.lang.String unitURI)  
      UnitsOfMeasure​(org.opengis.referencing.crs.CoordinateReferenceSystem crs)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Double conversion​(double sourceDistance, java.lang.String sourceDistanceUnitsURI, java.lang.String targetDistanceUnitsURI)
      Conversion from target distance in units to source Units Of Measure.
      static java.lang.Double conversion​(double sourceDistance, UnitsOfMeasure sourceUnits, UnitsOfMeasure targetUnits)
      Conversion from target distance in units to source Units Of Measure.
      static double convertBetween​(double distance, java.lang.String unitsURI, java.lang.String targetDistanceUnitsURI, boolean isTargetUnitsLinear, double latitude)
      Convert between linear and non-linear units and vice versa.
      Will convert linear/linear and non-linear/non-linear units.
      static double convertToDegrees​(double distance, java.lang.String unitsURI, double latitude)
      Provides conversion of linear units to degrees.
      static double convertToMetres​(double distance, java.lang.String unitsURI, double latitude)  
      boolean equals​(java.lang.Object obj)  
      javax.measure.Unit<javax.measure.quantity.Length> getUnit()  
      java.lang.String getUnitURI()  
      int hashCode()  
      boolean isLinearUnits()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • UnitsOfMeasure

        public UnitsOfMeasure​(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
      • UnitsOfMeasure

        public UnitsOfMeasure​(java.lang.String unitURI)
    • Method Detail

      • getUnit

        public javax.measure.Unit<javax.measure.quantity.Length> getUnit()
      • getUnitURI

        public java.lang.String getUnitURI()
      • isLinearUnits

        public boolean isLinearUnits()
      • conversion

        public static final java.lang.Double conversion​(double sourceDistance,
                                                        java.lang.String sourceDistanceUnitsURI,
                                                        java.lang.String targetDistanceUnitsURI)
                                                 throws UnitsConversionException
        Conversion from target distance in units to source Units Of Measure.
        Parameters:
        sourceDistance -
        sourceDistanceUnitsURI -
        targetDistanceUnitsURI -
        Returns:
        Distance after conversion.
        Throws:
        UnitsConversionException
      • convertBetween

        public static final double convertBetween​(double distance,
                                                  java.lang.String unitsURI,
                                                  java.lang.String targetDistanceUnitsURI,
                                                  boolean isTargetUnitsLinear,
                                                  double latitude)
        Convert between linear and non-linear units and vice versa.
        Will convert linear/linear and non-linear/non-linear units.
        Parameters:
        distance -
        unitsURI -
        targetDistanceUnitsURI -
        isTargetUnitsLinear -
        latitude -
        Returns:
        Distance in target units.
      • convertToDegrees

        public static final double convertToDegrees​(double distance,
                                                    java.lang.String unitsURI,
                                                    double latitude)
        Provides conversion of linear units to degrees.
        Conversion from linear (i.e. metres) to degrees based on equatorial radius of 111.32km.
        Therefore, this should only be used for rough bounding area before using more precise distance methods of GeometryWrapper.
        Parameters:
        distance -
        unitsURI -
        latitude -
        Returns:
        Converted distance in the provided units.
      • convertToMetres

        public static final double convertToMetres​(double distance,
                                                   java.lang.String unitsURI,
                                                   double latitude)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object