Package org.locationtech.proj4j.proj
Class Projection
java.lang.Object
org.locationtech.proj4j.proj.Projection
- All Implemented Interfaces:
Serializable
,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
,GeocentProjection
,GeostationarySatelliteProjection
,Ginsburg8Projection
,GoodeProjection
,HatanoProjection
,KrovakProjection
,LagrangeProjection
,LambertAzimuthalEqualAreaProjection
,LandsatProjection
,LarriveeProjection
,LaskowskiProjection
,LinearProjection
,LongLatProjection
,McBrydeThomasFlatPolarParabolicProjection
,McBrydeThomasFlatPolarSine2Projection
,NellHProjection
,NellProjection
,NewZealandMapGridProjection
,NicolosiProjection
,NullProjection
,PerspectiveProjection
,PolyconicProjection
,PutninsP2Projection
,PutninsP4Projection
,PutninsP5Projection
,RectangularPolyconicProjection
,SwissObliqueMercatorProjection
,TransverseCylindricalEqualArea
,UrmaevFlatPolarSinusoidalProjection
,VanDerGrintenProjection
,Wagner2Projection
,Wagner7Projection
A map projection is a mathematical algorithm
for representing a spheroidal surface
on a plane.
A single projection
defines a (usually infinite) family of
CoordinateReferenceSystem
s,
distinguished by different values for the
projection parameters.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
The equator radiusprotected double
The projection alpha valueprivate AxisOrder
The order of axes for the coordinate system.protected static final double
protected double
The eccentricityprotected Ellipsoid
The ellipsoid used by this projectionprotected static final double
protected double
The eccentricity squaredprotected double
The false Easting of this projectionprotected double
The false Northing of this projectionprotected double
Conversion factor from metres to whatever units the projection uses.protected boolean
True if this projection is geocentricprotected double
The projection lonc valueprotected double
The maximum latitude of the bounds of this projectionprotected double
The maximum longitude of the bounds of this projection.protected double
The minimum latitude of the bounds of this projectionprotected double
The minimum longitude of the bounds of this projection.protected String
The name of this projectionprotected double
1-(eccentricity squared)private PrimeMeridian
PrimeMeridian defining an offset from the Greenwich (the prime meridian used in WGS84)protected double
The latitude of the centre of projectionprotected double
Standard parallel 1 (for projections which use it)protected double
Standard parallel 2 (for projections which use it)protected double
The longitude of the centre of projection, in radiansprotected double
1/(1-(eccentricity squared))protected static final double
protected double
The projection scale factorprotected boolean
True if this projection is using a sphere (es == 0)private double
falseEasting, adjusted to the appropriate units using fromMetresprivate double
falseNorthing, adjusted to the appropriate units using fromMetresprotected double
The total scale factor = Earth radius * unitsprotected double
The latitude of true scale.protected Unit
units of this projection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
Represents quality between possible outputs ofproject(ProjCoordinate, ProjCoordinate)
.double
getAlpha()
Gets the alpha value, in radians.int
Returns the ESPG code for this projection, or 0 if unknown.double
double
double
double
double
Get height of orbit - Geostationary satellite projectiondouble
getLonC()
Gets the lonc value, in radians.double
double
double
double
double
double
double
double
getName()
Get a string which describes this projection in PROJ.4 format.double
double
double
double
double
double
double
double
double
Gets the projection scale factor.boolean
double
double
getUnits()
int
hashCode()
Hash of those fields considered in Projection equalituy.boolean
Tests whether this projection has an inverse.void
Initialize the projection.boolean
inside
(double x, double y) Returns true if the given lat/long point is visible in this projectioninverseProject
(ProjCoordinate src, ProjCoordinate dst) Inverse-projects a point (in the units defined by the coordinate system), producing a geographic result (in degrees)Inverse-transforms a point (in the units defined by the coordinate system), producing a geographic result (in radians)boolean
Tests whether this projection is conformal.boolean
Tests whether this projection is equal-area An equal-area projection preserves relative sizes of projected areas.Is this "projection" longlat? Overridden in LongLatProjection.boolean
Tests whether under this projection lines of latitude and longitude form a rectangular gridstatic float
normalizeLongitude
(float angle) static double
normalizeLongitudeRadians
(double angle) boolean
Returns true if latitude lines are parallel for this projectionprotected ProjCoordinate
project
(double x, double y, ProjCoordinate dst) Computes the projection of a given point (i.e.project
(ProjCoordinate src, ProjCoordinate dst) Projects a geographic point (in degrees), producing a projected result (in the units of the target coordinate system).protected ProjCoordinate
projectInverse
(double x, double y, ProjCoordinate dst) Computes the inverse projection of a given point (i.e.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).projectRadians
(ProjCoordinate src, ProjCoordinate dst) Projects a geographic point (in radians), producing a projected result (in the units of the target coordinate system).void
setAlpha
(double alpha) Sets the alpha value.void
setAlphaDegrees
(double alpha) Sets the alpha value.void
setAxisOrder
(String axes) void
setEllipsoid
(Ellipsoid ellipsoid) void
setFalseEasting
(double falseEasting) Set the false Easting in projected units.void
setFalseNorthing
(double falseNorthing) Set the false Northing in projected units.void
setFromMetres
(double fromMetres) Set the conversion factor from metres to projected units.void
setGamma
(double gamma) void
setGammaDegrees
(double gamma) void
setHeightOfOrbit
(double h) Set height of orbit - Geostationary satellite projectionvoid
setLonC
(double lonc) Sets the lonc value.void
setLonCDegrees
(double lonc) Sets the lonc value.void
setMaxLatitude
(double maxLatitude) Set the maximum latitude.void
setMaxLongitude
(double maxLongitude) void
setMaxLongitudeDegrees
(double maxLongitude) void
setMinLatitude
(double minLatitude) Set the minimum latitude.void
setMinLongitude
(double minLongitude) void
setMinLongitudeDegrees
(double minLongitude) void
Set the name of this projection.void
setNoUoff
(boolean no_uoff) void
setPrimeMeridian
(String primeMeridian) void
setProjectionLatitude
(double projectionLatitude) Set the projection latitude in radians.void
setProjectionLatitude1
(double projectionLatitude1) Set the projection latitude in radians.void
setProjectionLatitude1Degrees
(double projectionLatitude1) Set the projection latitude in degrees.void
setProjectionLatitude2
(double projectionLatitude2) Set the projection latitude in radians.void
setProjectionLatitude2Degrees
(double projectionLatitude2) Set the projection latitude in degrees.void
setProjectionLatitudeDegrees
(double projectionLatitude) Set the projection latitude in degrees.void
setProjectionLongitude
(double projectionLongitude) Set the projection longitude in radians.void
setProjectionLongitudeDegrees
(double projectionLongitude) Set the projection longitude in degrees.void
setRadius
(double radius) void
setScaleFactor
(double scaleFactor) Set the projection scale factor.void
setSouthernHemisphere
(boolean isSouth) void
setTrueScaleLatitude
(double trueScaleLatitude) Set the latitude of true scale in radians.void
setTrueScaleLatitudeDegrees
(double trueScaleLatitude) Set the latitude of true scale in degrees.void
toString()
-
Field Details
-
minLatitude
protected double minLatitudeThe minimum latitude of the bounds of this projection -
minLongitude
protected double minLongitudeThe minimum longitude of the bounds of this projection. This is relative to the projection centre. -
maxLatitude
protected double maxLatitudeThe maximum latitude of the bounds of this projection -
maxLongitude
protected double maxLongitudeThe maximum longitude of the bounds of this projection. This is relative to the projection centre. -
projectionLatitude
protected double projectionLatitudeThe latitude of the centre of projection -
projectionLongitude
protected double projectionLongitudeThe longitude of the centre of projection, in radians -
projectionLatitude1
protected double projectionLatitude1Standard parallel 1 (for projections which use it) -
projectionLatitude2
protected double projectionLatitude2Standard parallel 2 (for projections which use it) -
alpha
protected double alphaThe projection alpha value -
lonc
protected double loncThe projection lonc value -
scaleFactor
protected double scaleFactorThe projection scale factor -
falseEasting
protected double falseEastingThe false Easting of this projection -
falseNorthing
protected double falseNorthingThe false Northing of this projection -
trueScaleLatitude
protected double trueScaleLatitudeThe latitude of true scale. Only used by specific projections. -
a
protected double aThe equator radius -
e
protected double eThe eccentricity -
es
protected double esThe eccentricity squared -
one_es
protected double one_es1-(eccentricity squared) -
rone_es
protected double rone_es1/(1-(eccentricity squared)) -
ellipsoid
The ellipsoid used by this projection -
spherical
protected boolean sphericalTrue if this projection is using a sphere (es == 0) -
geocentric
protected boolean geocentricTrue if this projection is geocentric -
name
The name of this projection -
fromMetres
protected double fromMetresConversion factor from metres to whatever units the projection uses. -
totalScale
protected double totalScaleThe total scale factor = Earth radius * units -
totalFalseEasting
private double totalFalseEastingfalseEasting, adjusted to the appropriate units using fromMetres -
totalFalseNorthing
private double totalFalseNorthingfalseNorthing, adjusted to the appropriate units using fromMetres -
unit
units of this projection. Default is metres, but may be degrees -
primeMeridian
PrimeMeridian defining an offset from the Greenwich (the prime meridian used in WGS84) -
axes
The order of axes for the coordinate system. Default is easting, northing, vertical (up) -
EPS10
protected static final double EPS10- See Also:
-
RTD
protected static final double RTD- See Also:
-
DTR
protected static final double DTR- See Also:
-
-
Constructor Details
-
Projection
protected Projection()
-
-
Method Details
-
clone
-
project
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
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
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
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
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
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
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
Set the name of this projection. -
getName
-
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
-
setAxisOrder
-
getAxisOrder
-
setPrimeMeridian
-
getPrimeMeridian
-
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
-
getEllipsoid
-
setRadius
public void setRadius(double radius) -
getEPSGCode
public int getEPSGCode()Returns the ESPG code for this projection, or 0 if unknown. -
setUnits
-
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
Is this "projection" longlat? Overridden in LongLatProjection. -
equals
Represents quality between possible outputs ofproject(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. -
hashCode
public int hashCode()Hash of those fields considered in Projection equalituy. Subclasses that override equality should override hashCode.
-