Class Projection
- java.lang.Object
-
- org.meteoinfo.projection.proj4j.proj.Projection
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
AiryProjection,AlbersProjection,AugustProjection,AzimuthalProjection,BipolarProjection,BonneProjection,CassiniProjection,CollignonProjection,ConicProjection,CrasterProjection,CylindricalEqualAreaProjection,CylindricalProjection,DenoyerProjection,Eckert1Projection,Eckert2Projection,Eckert4Projection,Eckert5Projection,FaheyProjection,FoucautSinusoidalProjection,GallProjection,GaussProjection,GeneralObliqueProjection,GeostationarySatelliteProjection,Ginsburg8Projection,GoodeProjection,HatanoProjection,LagrangeProjection,LambertAzimuthalEqualAreaProjection,LandsatProjection,LarriveeProjection,LaskowskiProjection,LinearProjection,LongLatProjection,McBrydeThomasFlatPolarParabolicProjection,McBrydeThomasFlatPolarSine2Projection,NellHProjection,NellProjection,NicolosiProjection,NullProjection,PerspectiveProjection,PolyconicProjection,PutninsP2Projection,PutninsP4Projection,PutninsP5Projection,RectangularPolyconicProjection,SwissObliqueMercatorProjection,TransverseCylindricalEqualArea,UrmaevFlatPolarSinusoidalProjection,VanDerGrintenProjection,Wagner2Projection,Wagner7Projection
public abstract class Projection extends java.lang.Object implements java.lang.CloneableA map projection is a mathematical algorithm for representing a spheroidal surface on a plane. A single projection defines a (usually infinite) family ofCoordinateReferenceSystems, distinguished by different values for the projection parameters.
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleaThe equator radiusprotected doublealphaThe projection alpha valueprotected static doubleDTRprotected doubleeThe eccentricityprotected EllipsoidellipsoidThe ellipsoid used by this projectionprotected static doubleEPS10protected doubleesThe eccentricity squaredprotected doublefalseEastingThe false Easting of this projectionprotected doublefalseNorthingThe false Northing of this projectionprotected doublefromMetresConversion factor from metres to whatever units the projection uses.protected booleangeocentricTrue if this projection is geocentricprotected static doubleHALFPIprotected doubleheightOfOrbitHeight of orbit - Geostationary satellite projectionprotected booleanisSouthIndicates whether a Southern Hemisphere UTM zoneprotected doubleloncThe projection lonc valueprotected doublemaxLatitudeThe maximum latitude of the bounds of this projectionprotected doublemaxLongitudeThe maximum longitude of the bounds of this projection.protected doubleminLatitudeThe minimum latitude of the bounds of this projectionprotected doubleminLongitudeThe minimum longitude of the bounds of this projection.protected java.lang.StringnameThe name of this projectionprotected doubleone_es1-(eccentricity squared)protected java.lang.Stringproj4Nameprotected doubleprojectionLatitudeThe latitude of the centre of projectionprotected doubleprojectionLatitude1Standard parallel 1 (for projections which use it)protected doubleprojectionLatitude1Degreesprotected doubleprojectionLatitude2Standard parallel 2 (for projections which use it)protected doubleprojectionLatitude2Degreesprotected doubleprojectionLatitudeDegreesprotected doubleprojectionLongitudeThe longitude of the centre of projection, in radiansprotected doubleprojectionLongitudeDegreesprotected doublerone_es1/(1-(eccentricity squared))protected static doubleRTDprotected doublescaleFactorThe projection scale factorprotected booleansphericalTrue if this projection is using a sphere (es == 0)protected doubletotalScaleThe total scale factor = Earth radius * unitsprotected doubletrueScaleLatitudeThe latitude of true scale.protected doubletrueScaleLatitudeDegreesprotected Unitunitunits of this projection.
-
Constructor Summary
Constructors Modifier Constructor Description protectedProjection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()doublegetAlpha()Gets the alpha value, in radians.EllipsoidgetEllipsoid()intgetEPSGCode()Returns the ESPG code for this projection, or 0 if unknown.doublegetEquatorRadius()doublegetFalseEasting()doublegetFalseNorthing()doublegetFromMetres()doublegetHeightOfOrbit()Get height of orbit - Geostationary satellite projectiondoublegetLonC()Gets the lonc value, in radians.doublegetMaxLatitude()doublegetMaxLatitudeDegrees()doublegetMaxLongitude()doublegetMaxLongitudeDegrees()doublegetMinLatitude()doublegetMinLatitudeDegrees()doublegetMinLongitude()doublegetMinLongitudeDegrees()java.lang.StringgetName()Get projection namejava.lang.StringgetPROJ4Description()Get a string which describes this projection in PROJ.4 format.java.lang.StringgetProj4Name()Get proj4 projection namedoublegetProjectionLatitude()doublegetProjectionLatitude1()doublegetProjectionLatitude1Degrees()doublegetProjectionLatitude2()doublegetProjectionLatitude2Degrees()doublegetProjectionLatitudeDegrees()doublegetProjectionLongitude()doublegetProjectionLongitudeDegrees()doublegetScaleFactor()Gets the projection scale factor.booleangetSouthernHemisphere()doublegetTrueScaleLatitude()doublegetTrueScaleLatitudeDegrees()booleanhasInverse()Tests whether this projection has an inverse.voidinitialize()Initialize the projection.booleaninside(double x, double y)Returns true if the given lat/long point is visible in this projectionProjCoordinateinverseProject(ProjCoordinate src, ProjCoordinate dst)Inverse-projects a point (in the units defined by the coordinate system), producing a geographic result (in degrees)ProjCoordinateinverseProjectRadians(ProjCoordinate src, ProjCoordinate dst)Inverse-transforms a point (in the units defined by the coordinate system), producing a geographic result (in radians)booleanisConformal()Tests whether this projection is conformal.booleanisEqual(Projection proj)Check if this projection is equal with other projectionbooleanisEqualArea()Tests whether this projection is equal-area An equal-area projection preserves relative sizes of projected areas.booleanisRectilinear()Tests whether under this projection lines of latitude and longitude form a rectangular gridstatic floatnormalizeLongitude(float angle)static doublenormalizeLongitudeRadians(double angle)booleanparallelsAreParallel()Returns true if latitude lines are parallel for this projectionprotected ProjCoordinateproject(double x, double y, ProjCoordinate dst)Computes the projection of a given point (i.e.ProjCoordinateproject(ProjCoordinate src, ProjCoordinate dst)Projects a geographic point (in degrees), producing a projected result (in the units of the target coordinate system).protected ProjCoordinateprojectInverse(double x, double y, ProjCoordinate dst)Computes the inverse projection of a given point (i.e.ProjCoordinateprojectRadians(ProjCoordinate src, ProjCoordinate dst)Projects a geographic point (in radians), producing a projected result (in the units of the target coordinate system).voidsetAlphaDegrees(double alpha)Sets the alpha value.voidsetEllipsoid(Ellipsoid ellipsoid)voidsetFalseEasting(double falseEasting)Set the false Easting in projected units.voidsetFalseNorthing(double falseNorthing)Set the false Northing in projected units.voidsetFromMetres(double fromMetres)Set the conversion factor from metres to projected units.voidsetHeightOfOrbit(double h)Set height of orbit - Geostationary satellite projectionvoidsetLonCDegrees(double lonc)Sets the lonc value.voidsetMaxLatitude(double maxLatitude)Set the maximum latitude.voidsetMaxLongitude(double maxLongitude)voidsetMaxLongitudeDegrees(double maxLongitude)voidsetMinLatitude(double minLatitude)Set the minimum latitude.voidsetMinLongitude(double minLongitude)voidsetMinLongitudeDegrees(double minLongitude)voidsetName(java.lang.String name)Set the name of this projection.voidsetProjectionLatitude(double projectionLatitude)Set the projection latitude in radians.voidsetProjectionLatitude1(double projectionLatitude1)Set the projection latitude in radians.voidsetProjectionLatitude1Degrees(double projectionLatitude1)Set the projection latitude in degrees.voidsetProjectionLatitude2(double projectionLatitude2)Set the projection latitude in radians.voidsetProjectionLatitude2Degrees(double projectionLatitude2)Set the projection latitude in degrees.voidsetProjectionLatitudeDegrees(double projectionLatitude)Set the projection latitude in degrees.voidsetProjectionLongitude(double projectionLongitude)Set the projection longitude in radians.voidsetProjectionLongitudeDegrees(double projectionLongitude)Set the projection longitude in degrees.voidsetScaleFactor(double scaleFactor)Set the projection scale factor.voidsetSouthernHemisphere(boolean isSouth)voidsetTrueScaleLatitude(double trueScaleLatitude)Set the latitude of true scale in radians.voidsetTrueScaleLatitudeDegrees(double trueScaleLatitude)Set the latitude of true scale in degrees.voidsetUnits(Unit unit)java.lang.StringtoString()
-
-
-
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
-
projectionLatitudeDegrees
protected double projectionLatitudeDegrees
-
projectionLongitude
protected double projectionLongitude
The longitude of the centre of projection, in radians
-
projectionLongitudeDegrees
protected double projectionLongitudeDegrees
-
projectionLatitude1
protected double projectionLatitude1
Standard parallel 1 (for projections which use it)
-
projectionLatitude1Degrees
protected double projectionLatitude1Degrees
-
projectionLatitude2
protected double projectionLatitude2
Standard parallel 2 (for projections which use it)
-
projectionLatitude2Degrees
protected double projectionLatitude2Degrees
-
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
-
isSouth
protected boolean isSouth
Indicates whether a Southern Hemisphere UTM zone
-
trueScaleLatitude
protected double trueScaleLatitude
The latitude of true scale. Only used by specific projections.
-
trueScaleLatitudeDegrees
protected double trueScaleLatitudeDegrees
-
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
-
unit
protected Unit unit
units of this projection. Default is metres, but may be degrees
-
heightOfOrbit
protected double heightOfOrbit
Height of orbit - Geostationary satellite projection
-
proj4Name
protected java.lang.String proj4Name
-
HALFPI
protected static final double HALFPI
- See Also:
- Constant Field Values
-
EPS10
protected static final double EPS10
- See Also:
- Constant Field Values
-
RTD
protected static final double RTD
- See Also:
- Constant Field Values
-
DTR
protected static final double DTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.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
-
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
-
hasInverse
public boolean hasInverse()
Tests whether this projection has an inverse. If this method returns true then theinverseProject(ProjCoordinate, ProjCoordinate)andinverseProjectRadians(ProjCoordinate, ProjCoordinate)methods will return meaningful results.- Returns:
- true if this projection has an inverse
-
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()
Get projection name- Returns:
- Projection name
-
getProj4Name
public java.lang.String getProj4Name()
Get proj4 projection name- Returns:
- Proj4 projection name
-
getPROJ4Description
public java.lang.String getPROJ4Description()
Get a string which describes this projection in PROJ.4 format.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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()
-
setAlphaDegrees
public void setAlphaDegrees(double alpha)
Sets the alpha value.
-
getAlpha
public double getAlpha()
Gets the alpha value, in radians.- Returns:
- the alpha 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.- Parameters:
scaleFactor- Scale factor
-
getScaleFactor
public double getScaleFactor()
Gets the projection scale factor. This value is called "k0" in PROJ.4.- Returns:
- Projection scale factor
-
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()
-
getEPSGCode
public int getEPSGCode()
Returns the ESPG code for this projection, or 0 if unknown.
-
setUnits
public void setUnits(Unit unit)
-
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)
-
isEqual
public boolean isEqual(Projection proj)
Check if this projection is equal with other projection- Parameters:
proj- The other projection- Returns:
- Boolean
-
-