Class GeographicProjection

All Implemented Interfaces:
Cloneable, ProjectionConstants

public class GeographicProjection extends GCTPCStyleProjection
The GeographicProjection class performs geographic map projection calculations.
Since:
3.3.0
Author:
Peter Hollemans
  • Constructor Details

    • GeographicProjection

      public GeographicProjection(double rMajor, double rMinor, int[] dimensions, AffineTransform affine) throws NoninvertibleTransformException
      Constructs a map projection from the specified projection and affine transform. The SpheroidConstants and ProjectionConstants class should be consulted for valid parameter constants.
      Parameters:
      rMajor - the semi-major axis in meters.
      rMinor - the semi-minor axis in meters.
      dimensions - the dimensions of the data grid as [rows, columns].
      affine - the affine transform for translating data [row, column] to map [x, y].
      Throws:
      NoninvertibleTransformException - if the map projection to data coordinate affine transform is not invertible.
  • Method Details

    • setAffine

      protected void setAffine(EarthLocation centerLoc, double[] pixelDims) throws NoninvertibleTransformException
      Description copied from class: MapProjection
      Sets the affines for this projection based on center and pixel dimensions.
      Overrides:
      setAffine in class MapProjection
      Parameters:
      centerLoc - the earth location at the map center.
      pixelDims - the pixel dimensions in meters at the projection reference point as [height, width].
      Throws:
      NoninvertibleTransformException - if the map projection to data coordinate affine transform is not invertible.
    • getSubset

      public EarthTransform getSubset(DataLocation newOrigin, int[] newDims)
      Description copied from class: EarthTransform
      Creates and returns a new subset transform. The new transform is arranged with the specified new origin and dimensions. For example, if the transform maps the data location (100,100) to earth location (40N, 120W), and a translated transform is created with (100,100) as the new origin, then the new transform will map (0,0) to (40N, 120W). Note that not all transforms support subsets.
      Overrides:
      getSubset in class MapProjection
      Parameters:
      newOrigin - the new data location origin.
      newDims - the new data location dimensions.
    • getSubset

      public MapProjection getSubset(int[] start, int[] stride, int[] length)
      Description copied from class: MapProjection
      Creates a subset version of this map projection.
      Overrides:
      getSubset in class MapProjection
      Parameters:
      start - the 2D starting data coordinates.
      stride - the 2D data stride.
      length - the total number of values in each dimension.
      Returns:
      the subset and/or subsampled transform.
    • transformImpl

      protected void transformImpl(DataLocation dataLoc, EarthLocation earthLoc)
      Description copied from class: EarthTransform
      Implements the data to geographic transform.
      Overrides:
      transformImpl in class MapProjection
      See Also:
    • transformImpl

      protected void transformImpl(EarthLocation earthLoc, DataLocation dataLoc)
      Description copied from class: EarthTransform
      Implements the geographic to data transform.
      Overrides:
      transformImpl in class MapProjection
      See Also:
    • projfor

      protected long projfor(double lat, double lon, double[] x, double[] y)
      Description copied from class: GCTPCStyleProjection
      Performs the actual forward calculation as specified in the GCTP C code. This method is as close as possible to the native C function signature.
      Specified by:
      projfor in class GCTPCStyleProjection
      Parameters:
      lat - the latitude to convert.
      lon - the longitude to convert.
      x - the map coordinate x value (modified).
      y - the map coordinate y value (modified).
      Returns:
      OK on success, or not OK on failure.
    • projinv

      protected long projinv(double x, double y, double[] lon, double[] lat)
      Description copied from class: GCTPCStyleProjection
      Performs the actual inverse calculation as specified in the GCTP C code. This method is as close as possible to the native C function signature.
      Specified by:
      projinv in class GCTPCStyleProjection
      Parameters:
      x - the map coordinate x value (modified).
      y - the map coordinate y value (modified).
      lon - the longitude to convert.
      lat - the latitude to convert.
      Returns:
      OK on success, or not OK on failure.
    • isBoundaryCut

      public boolean isBoundaryCut(EarthLocation a, EarthLocation b)
      The geographic implementation of the boundary cut test.