Class Projection

    • Field Detail

      • minLatitude

        protected double minLatitude
        The minimum latitude of the bounds of this projection
      • minLongitude

        protected double minLongitude
        The minimum longitude of the bounds of this projection. This is relative to the projection centre.
      • maxLatitude

        protected double maxLatitude
        The maximum latitude of the bounds of this projection
      • maxLongitude

        protected double maxLongitude
        The maximum longitude of the bounds of this projection. This is relative to the projection centre.
      • projectionLatitude

        protected double projectionLatitude
        The latitude of the centre of projection
      • projectionLongitude

        protected double projectionLongitude
        The longitude of the centre of projection, in radians
      • projectionLatitude1

        protected double projectionLatitude1
        Standard parallel 1 (for projections which use it)
      • projectionLatitude2

        protected double projectionLatitude2
        Standard parallel 2 (for projections which use it)
      • alpha

        protected double alpha
        The projection alpha value
      • lonc

        protected double lonc
        The projection lonc value
      • scaleFactor

        protected double scaleFactor
        The projection scale factor
      • falseEasting

        protected double falseEasting
        The false Easting of this projection
      • falseNorthing

        protected double falseNorthing
        The false Northing of this projection
      • trueScaleLatitude

        protected double trueScaleLatitude
        The latitude of true scale. Only used by specific projections.
      • a

        protected double a
        The equator radius
      • e

        protected double e
        The eccentricity
      • es

        protected double es
        The eccentricity squared
      • one_es

        protected double one_es
        1-(eccentricity squared)
      • rone_es

        protected double rone_es
        1/(1-(eccentricity squared))
      • ellipsoid

        protected Ellipsoid ellipsoid
        The ellipsoid used by this projection
      • spherical

        protected boolean spherical
        True if this projection is using a sphere (es == 0)
      • geocentric

        protected boolean geocentric
        True if this projection is geocentric
      • name

        protected java.lang.String name
        The name of this projection
      • fromMetres

        protected double fromMetres
        Conversion factor from metres to whatever units the projection uses.
      • totalScale

        protected double totalScale
        The total scale factor = Earth radius * units
      • totalFalseEasting

        private double totalFalseEasting
        falseEasting, adjusted to the appropriate units using fromMetres
      • totalFalseNorthing

        private double totalFalseNorthing
        falseNorthing, adjusted to the appropriate units using fromMetres
      • unit

        protected Unit unit
        units of this projection. Default is metres, but may be degrees
      • primeMeridian

        private PrimeMeridian primeMeridian
        PrimeMeridian defining an offset from the Greenwich (the prime meridian used in WGS84)
      • axes

        private AxisOrder axes
        The order of axes for the coordinate system. Default is easting, northing, vertical (up)
    • Constructor Detail

      • Projection

        protected Projection()
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • project

        public ProjCoordinate project​(ProjCoordinate src,
                                      ProjCoordinate dst)
        Projects a geographic point (in degrees), producing a projected result (in the units of the target coordinate system).
        Parameters:
        src - the input geographic coordinate (in degrees)
        dst - the projected coordinate (in coordinate system units)
        Returns:
        the target coordinate
      • projectRadians

        public ProjCoordinate projectRadians​(ProjCoordinate src,
                                             ProjCoordinate dst)
        Projects a geographic point (in radians), producing a projected result (in the units of the target coordinate system).
        Parameters:
        src - the input geographic coordinate (in radians)
        dst - the projected coordinate (in coordinate system units)
        Returns:
        the target coordinate
      • projectRadians

        private ProjCoordinate projectRadians​(double x,
                                              double y,
                                              ProjCoordinate dst)
        Transform a geographic point (in radians), producing a projected result (in the units of the target coordinate system).
        Parameters:
        x - the geographic x ordinate (in radians)
        y - the geographic y ordinate (in radians)
        dst - the projected coordinate (in coordinate system units)
        Returns:
        the target coordinate
      • project

        protected ProjCoordinate project​(double x,
                                         double y,
                                         ProjCoordinate dst)
        Computes the projection of a given point (i.e. from geographics to projection space). This should be overridden for all projections.
        Parameters:
        x - the geographic x ordinate (in radians)
        y - the geographic y ordinatee (in radians)
        dst - the projected coordinate (in coordinate system units)
        Returns:
        the target coordinate
      • inverseProject

        public ProjCoordinate inverseProject​(ProjCoordinate src,
                                             ProjCoordinate dst)
        Inverse-projects a point (in the units defined by the coordinate system), producing a geographic result (in degrees)
        Parameters:
        src - the input projected coordinate (in coordinate system units)
        dst - the inverse-projected geographic coordinate (in degrees)
        Returns:
        the target coordinate
      • inverseProjectRadians

        public ProjCoordinate inverseProjectRadians​(ProjCoordinate src,
                                                    ProjCoordinate dst)
        Inverse-transforms a point (in the units defined by the coordinate system), producing a geographic result (in radians)
        Parameters:
        src - the input projected coordinate (in coordinate system units)
        dst - the inverse-projected geographic coordinate (in radians)
        Returns:
        the target coordinate
      • projectInverse

        protected ProjCoordinate projectInverse​(double x,
                                                double y,
                                                ProjCoordinate dst)
        Computes the inverse projection of a given point (i.e. from projection space to geographics). This should be overridden for all projections.
        Parameters:
        x - the projected x ordinate (in coordinate system units)
        y - the projected y ordinate (in coordinate system units)
        dst - the inverse-projected geographic coordinate (in radians)
        Returns:
        the target coordinate
      • isConformal

        public boolean isConformal()
        Tests whether this projection is conformal. A conformal projection preserves local angles.
        Returns:
        true if this projection is conformal
      • isEqualArea

        public boolean isEqualArea()
        Tests whether this projection is equal-area An equal-area projection preserves relative sizes of projected areas.
        Returns:
        true if this projection is equal-area
      • isRectilinear

        public boolean isRectilinear()
        Tests whether under this projection lines of latitude and longitude form a rectangular grid
      • parallelsAreParallel

        public boolean parallelsAreParallel()
        Returns true if latitude lines are parallel for this projection
      • inside

        public boolean inside​(double x,
                              double y)
        Returns true if the given lat/long point is visible in this projection
      • setName

        public void setName​(java.lang.String name)
        Set the name of this projection.
      • getName

        public java.lang.String getName()
      • getPROJ4Description

        public java.lang.String getPROJ4Description()
        Get a string which describes this projection in PROJ.4 format.

        WARNING: currently this does not output all required parameters in some cases. E.g. for Albers the standard latitudes are missing.

      • toString

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

        public void setAxisOrder​(java.lang.String axes)
      • getAxisOrder

        public AxisOrder getAxisOrder()
      • setPrimeMeridian

        public void setPrimeMeridian​(java.lang.String primeMeridian)
      • setMinLatitude

        public void setMinLatitude​(double minLatitude)
        Set the minimum latitude. This is only used for Shape clipping and doesn't affect projection.
      • getMinLatitude

        public double getMinLatitude()
      • setMaxLatitude

        public void setMaxLatitude​(double maxLatitude)
        Set the maximum latitude. This is only used for Shape clipping and doesn't affect projection.
      • getMaxLatitude

        public double getMaxLatitude()
      • getMaxLatitudeDegrees

        public double getMaxLatitudeDegrees()
      • getMinLatitudeDegrees

        public double getMinLatitudeDegrees()
      • setMinLongitude

        public void setMinLongitude​(double minLongitude)
      • getMinLongitude

        public double getMinLongitude()
      • setMinLongitudeDegrees

        public void setMinLongitudeDegrees​(double minLongitude)
      • getMinLongitudeDegrees

        public double getMinLongitudeDegrees()
      • setMaxLongitude

        public void setMaxLongitude​(double maxLongitude)
      • getMaxLongitude

        public double getMaxLongitude()
      • setMaxLongitudeDegrees

        public void setMaxLongitudeDegrees​(double maxLongitude)
      • getMaxLongitudeDegrees

        public double getMaxLongitudeDegrees()
      • setProjectionLatitude

        public void setProjectionLatitude​(double projectionLatitude)
        Set the projection latitude in radians.
      • getProjectionLatitude

        public double getProjectionLatitude()
      • setProjectionLatitudeDegrees

        public void setProjectionLatitudeDegrees​(double projectionLatitude)
        Set the projection latitude in degrees.
      • getProjectionLatitudeDegrees

        public double getProjectionLatitudeDegrees()
      • setProjectionLongitude

        public void setProjectionLongitude​(double projectionLongitude)
        Set the projection longitude in radians.
      • getProjectionLongitude

        public double getProjectionLongitude()
      • setProjectionLongitudeDegrees

        public void setProjectionLongitudeDegrees​(double projectionLongitude)
        Set the projection longitude in degrees.
      • getProjectionLongitudeDegrees

        public double getProjectionLongitudeDegrees()
      • setTrueScaleLatitude

        public void setTrueScaleLatitude​(double trueScaleLatitude)
        Set the latitude of true scale in radians. This is only used by certain projections.
      • getTrueScaleLatitude

        public double getTrueScaleLatitude()
      • setTrueScaleLatitudeDegrees

        public void setTrueScaleLatitudeDegrees​(double trueScaleLatitude)
        Set the latitude of true scale in degrees. This is only used by certain projections.
      • getTrueScaleLatitudeDegrees

        public double getTrueScaleLatitudeDegrees()
      • setProjectionLatitude1

        public void setProjectionLatitude1​(double projectionLatitude1)
        Set the projection latitude in radians.
      • getProjectionLatitude1

        public double getProjectionLatitude1()
      • setProjectionLatitude1Degrees

        public void setProjectionLatitude1Degrees​(double projectionLatitude1)
        Set the projection latitude in degrees.
      • getProjectionLatitude1Degrees

        public double getProjectionLatitude1Degrees()
      • setProjectionLatitude2

        public void setProjectionLatitude2​(double projectionLatitude2)
        Set the projection latitude in radians.
      • getProjectionLatitude2

        public double getProjectionLatitude2()
      • setProjectionLatitude2Degrees

        public void setProjectionLatitude2Degrees​(double projectionLatitude2)
        Set the projection latitude in degrees.
      • getProjectionLatitude2Degrees

        public double getProjectionLatitude2Degrees()
      • setAlpha

        public void setAlpha​(double alpha)
        Sets the alpha value.
      • setAlphaDegrees

        public void setAlphaDegrees​(double alpha)
        Sets the alpha value.
      • getAlpha

        public double getAlpha()
        Gets the alpha value, in radians.
        Returns:
        the alpha value
      • setLonC

        public void setLonC​(double lonc)
        Sets the lonc value.
      • setLonCDegrees

        public void setLonCDegrees​(double lonc)
        Sets the lonc value.
      • getLonC

        public double getLonC()
        Gets the lonc value, in radians.
        Returns:
        the lonc value
      • setFalseNorthing

        public void setFalseNorthing​(double falseNorthing)
        Set the false Northing in projected units.
      • getFalseNorthing

        public double getFalseNorthing()
      • setFalseEasting

        public void setFalseEasting​(double falseEasting)
        Set the false Easting in projected units.
      • getFalseEasting

        public double getFalseEasting()
      • setSouthernHemisphere

        public void setSouthernHemisphere​(boolean isSouth)
      • getSouthernHemisphere

        public boolean getSouthernHemisphere()
      • setScaleFactor

        public void setScaleFactor​(double scaleFactor)
        Set the projection scale factor. This is set to 1 by default. This value is called "k0" in PROJ.4.
      • getScaleFactor

        public double getScaleFactor()
        Gets the projection scale factor. This value is called "k0" in PROJ.4.
        Returns:
      • getEquatorRadius

        public double getEquatorRadius()
      • setFromMetres

        public void setFromMetres​(double fromMetres)
        Set the conversion factor from metres to projected units. This is set to 1 by default.
      • getFromMetres

        public double getFromMetres()
      • setEllipsoid

        public void setEllipsoid​(Ellipsoid ellipsoid)
      • getEllipsoid

        public Ellipsoid getEllipsoid()
      • setRadius

        public void setRadius​(double radius)
      • getEPSGCode

        public int getEPSGCode()
        Returns the ESPG code for this projection, or 0 if unknown.
      • setUnits

        public void setUnits​(Unit unit)
      • getUnits

        public Unit getUnits()
      • getHeightOfOrbit

        public double getHeightOfOrbit()
        Get height of orbit - Geostationary satellite projection
        Returns:
        Height of orbit
      • setHeightOfOrbit

        public void setHeightOfOrbit​(double h)
        Set height of orbit - Geostationary satellite projection
        Parameters:
        h - Height of orbit
      • initialize

        public void initialize()
        Initialize the projection. This should be called after setting parameters and before using the projection. This is for performance reasons as initialization may be expensive.
      • normalizeLongitude

        public static float normalizeLongitude​(float angle)
      • normalizeLongitudeRadians

        public static double normalizeLongitudeRadians​(double angle)
      • setGamma

        public void setGamma​(double gamma)
      • setGammaDegrees

        public void setGammaDegrees​(double gamma)
      • setNoUoff

        public void setNoUoff​(boolean no_uoff)
      • isGeographic

        public java.lang.Boolean isGeographic()
        Is this "projection" longlat? Overridden in LongLatProjection.
      • equals

        public boolean equals​(java.lang.Object that)
        Represents quality between possible outputs of project(ProjCoordinate, ProjCoordinate). Subclasses of Projection should capture additional state that is used in the project method and delgate to base. Note: The name of the projection is not part of equality.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Hash of those fields considered in Projection equalituy. Subclasses that override equality should override hashCode.
        Overrides:
        hashCode in class java.lang.Object