Class TLcdGeodetic
- All Implemented Interfaces:
ILcdProjection
,ILcdPropertyChangeSource
,Serializable
,Cloneable
Introduction
The geodetic projection is basically a linear transformation from lat-lon coordinates to XY world coordinates. The (lon,lat) are transformed to (x,y) coordinates with x=scaleX*lon and y=scaleY*lat.
Properties
- Neither equal-area nor conformal.
- Meridians and parallels are straight lines, equally spaced and intersecting each other at right angles.
- Poles are projected as straight lines.
Example
Sample code
ILcdProjection projection =
new TLcdGeodetic(10000.0, 10000.0);
Creating a grid reference using TLcdGeodetic.
Creating a grid reference that can be used as a world reference using a TLcdGeodetic
projection
is not straightforward. One must make sure that the unit of measure and scale values are correctly set.
By doing this, we make sure that values are transformed correctly to degrees, and that scale ranges are
interpreted correctly. Not doing this correctly may cause several scale related problems. For example using a scale
and unit-of-measure of 1 will make lon lat grids way to dense (making the application go out-of-memory) when
using this projection in the world reference of the view.
The following code shows how to correctly set up a grid reference with a geodetic projection:
public static TLcdGridReference createGeodeticGridReference(ILcdGeodeticDatum aDatum) {
ILcdEllipsoid ellipsoid = aDatum.getEllipsoid();
// Factor to convert a degree (along the equator) to meters
double uom = ellipsoid.getA() * Math.toRadians(1.0);
TLcdGeodetic projection = new TLcdGeodetic(uom, uom);
return new TLcdGridReference(aDatum,
projection,
0.0, 0.0, 1.0,
uom,
0.0);
}
- See Also:
-
Field Summary
Fields inherited from class com.luciad.projection.ALcdProjection
fPropertyChangeDispatcher
Fields inherited from interface com.luciad.projection.ILcdProjection
EPSILON
-
Constructor Summary
ConstructorDescriptionDefault constructor with scale factors 1.0 for both x and y directions.TLcdGeodetic
(double aXFactor, double aYFactor) Constructor with given scale factors for x and y axes. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
boundaryLats
(double aLongitude) Calculates the two latitude values that for a given longitude are at the boundary of the valid area of the transformation of the projection.double[][]
boundaryLons
(double aLatitude) Calculates the two longitude values for a given latitude that are at the boundary of the valid area of the transformation of the projection.clone()
Makes a deep clone of thisILcdProjection
.boolean
Checks if thisILcdProjection
equals some other Object.Origin of the projection is theILcd2DEditablePoint
that corresponds with origin (0, 0) of the cartesian coordinate system of the projection.double
Returns the scale factor along the X-axis.double
Returns the scale factor along the Y-axis.int
hashCode()
boolean
inLonLatBounds
(ILcdPoint aLLP) Checks if anILcd2DEditablePoint
is inside the valid area of the transformation of the projection.boolean
inWorldBoundsOnSphere
(ILcdPoint aXYPoint, double aRadius) Checks if aILcdPoint
is inside the valid cartesian area of the projection.boolean
If all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjection
and all (x,y ) coordinates are bounded this istrue
.boolean
AnILcdProjection
is continuous if there are no interruptions in the world coordinates.void
loadProperties
(String aPrefix, Properties aProperty) Loads the two properties of this geodetic projection, i.e., the scale factors along the two axes.void
lonlatheight2worldOnSphereSFCT
(ILcdPoint aLLP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) Transforms anILcd2DEditablePoint
on a sphere into the cartesian coordinate system of the projection.void
setScaleFactorX
(double aXFactor) Sets the scale factor along the X-axis.void
setScaleFactorY
(double aYFactor) Sets the scale factor along the Y-axis.toString()
Returns theString
representation of theTLcdGeodetic
projection.void
world2DEditableBoundsOnSphereSFCT
(double aRadius, ILcd2DEditableBounds aWorldBound) Sets theILcd2DEditableBounds
object to the bounds of the projection in world coordinates.void
world2lonlatOnSphereSFCT
(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPSFCT) Transforms anILcdPoint
from the cartesian coordinate system of the projection into anILcd2DEditablePoint
onto a sphere.void
writePropertiesSFCT
(String aPrefix, Properties aPropertySFCT) Writes the two properties of this geodetic projection, i.e., the scale factors along the two axes.Methods inherited from class com.luciad.projection.ALcdProjection
addPropertyChangeListener, firePropertyChangeEvent, inWorldBoundsOnEllipsoid, lonlatheight2worldOnEllipsoidSFCT, removePropertyChangeListener, world2DEditableBoundsOnEllipsoidSFCT, world2lonlatOnEllipsoidSFCT
-
Constructor Details
-
TLcdGeodetic
public TLcdGeodetic()Default constructor with scale factors 1.0 for both x and y directions. -
TLcdGeodetic
public TLcdGeodetic(double aXFactor, double aYFactor) Constructor with given scale factors for x and y axes.- Parameters:
aXFactor
- scale factor along X-axis.aYFactor
- scale factor along Y-axis.
-
-
Method Details
-
setScaleFactorX
public void setScaleFactorX(double aXFactor) Sets the scale factor along the X-axis.- Parameters:
aXFactor
- the new scaleFactorX value.- See Also:
-
getScaleFactorX
public double getScaleFactorX()Returns the scale factor along the X-axis.- Returns:
- the scale factor along the X-axis.
- See Also:
-
setScaleFactorY
public void setScaleFactorY(double aYFactor) Sets the scale factor along the Y-axis.- Parameters:
aYFactor
- the new scaleFactorY value.- See Also:
-
getScaleFactorY
public double getScaleFactorY()Returns the scale factor along the Y-axis.- Returns:
- the scale factor along the Y-axis.
- See Also:
-
getOrigin
Description copied from interface:ILcdProjection
Origin of the projection is theILcd2DEditablePoint
that corresponds with origin (0, 0) of the cartesian coordinate system of the projection.- Specified by:
getOrigin
in interfaceILcdProjection
- Returns:
- the origin of the projection.
-
loadProperties
Loads the two properties of this geodetic projection, i.e., the scale factors along the two axes. This method will, given aPrefix, analyze the aProperties object to set the properties of this projection. The values of following keys are retrieved:- <aPrefix>.scaleFactorX
- <aPrefix>.scaleFactorY
- Specified by:
loadProperties
in interfaceILcdProjection
- Parameters:
aPrefix
- prefix for property names.aProperty
- Properties object containing the serialized projection.- Throws:
IllegalArgumentException
-
writePropertiesSFCT
Writes the two properties of this geodetic projection, i.e., the scale factors along the two axes. This method will, given aPrefix, store the properties of this projection into the aPropertiesSFCT object. The values of following keys are stored:- <aPrefix>.scaleFactorX
- <aPrefix>.scaleFactorY
- Specified by:
writePropertiesSFCT
in interfaceILcdProjection
- Parameters:
aPrefix
- prefix for property names.aPropertySFCT
- Properties object in which to store the serialized projection properties as side effect.
-
lonlatheight2worldOnSphereSFCT
public void lonlatheight2worldOnSphereSFCT(ILcdPoint aLLP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException Description copied from interface:ILcdProjection
Transforms anILcd2DEditablePoint
on a sphere into the cartesian coordinate system of the projection.- Specified by:
lonlatheight2worldOnSphereSFCT
in interfaceILcdProjection
- Parameters:
aLLP
- point to be projected.aRadius
- radius of the sphere (meters).aXYPointSFCT
- projected point as side effect.- Throws:
TLcdOutOfBoundsException
- If theILcdPoint
aLLHP
is not within the valid area of the projection (visible area), then this exception is thrown.
-
world2lonlatOnSphereSFCT
public void world2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPSFCT) throws TLcdOutOfBoundsException Description copied from interface:ILcdProjection
Transforms anILcdPoint
from the cartesian coordinate system of the projection into anILcd2DEditablePoint
onto a sphere.- Specified by:
world2lonlatOnSphereSFCT
in interfaceILcdProjection
- Parameters:
aXYPoint
- projected point for which the corresponding geodetic point is sought.aRadius
- radius of the sphere (meters).aLLPSFCT
- resulting geodetic coordinate as side effect.- Throws:
TLcdOutOfBoundsException
- If theILcdPoint
aXYPoint
is not within the valid area of the projection (visible area), then this exception is thrown.
-
isAllInBounds
public boolean isAllInBounds()Description copied from interface:ILcdProjection
If all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjection
and all (x,y ) coordinates are bounded this istrue
. AllILcdProjection
objects have bounded (x,y ) coordinates because the projection is cut off if necessary.- Specified by:
isAllInBounds
in interfaceILcdProjection
- Returns:
true
if all LonLatPoints are within the bounds of the projection,false
otherwise.
-
isContinuous
public boolean isContinuous()Description copied from interface:ILcdProjection
AnILcdProjection
is continuous if there are no interruptions in the world coordinates. Most projections are continuous.- Specified by:
isContinuous
in interfaceILcdProjection
- Returns:
true
if the projection is continuous,false
otherwise.
-
inLonLatBounds
Checks if anILcd2DEditablePoint
is inside the valid area of the transformation of the projection.- Specified by:
inLonLatBounds
in interfaceILcdProjection
- Parameters:
aLLP
-ILcd2DEditablePoint
to be checked upon.- Returns:
true
if valid,false
if invalid.
-
boundaryLons
public double[][] boundaryLons(double aLatitude) Calculates the two longitude values for a given latitude that are at the boundary of the valid area of the transformation of the projection.- Specified by:
boundaryLons
in interfaceILcdProjection
- Overrides:
boundaryLons
in classALcdProjection
- Parameters:
aLatitude
- latitude in decimal degrees-90.0 <= lat <= 90.0
.- Returns:
- the array of longitudes[0] and longitudes[1], with longitudes[0] -> longitudes[1] is in visible area
and
-180.0 <= lon[i] <= 180.0
.
-
boundaryLats
public double[][] boundaryLats(double aLongitude) Calculates the two latitude values that for a given longitude are at the boundary of the valid area of the transformation of the projection.- Specified by:
boundaryLats
in interfaceILcdProjection
- Overrides:
boundaryLats
in classALcdProjection
- Parameters:
aLongitude
- longitude in decimal degrees-180.0 <= lon <= 180.0
.- Returns:
- the array of latitudes lats[0] and lats[1],
with lats[0] -> lats[1] is in visible area
and
-90.0 <= lats[i] <= 90.0
.
-
world2DEditableBoundsOnSphereSFCT
Description copied from interface:ILcdProjection
Sets theILcd2DEditableBounds
object to the bounds of the projection in world coordinates.- Specified by:
world2DEditableBoundsOnSphereSFCT
in interfaceILcdProjection
- Parameters:
aRadius
- radius of the sphere.aWorldBound
- the bounds of the projection in world coordinates as side effect.
-
inWorldBoundsOnSphere
Description copied from interface:ILcdProjection
Checks if aILcdPoint
is inside the valid cartesian area of the projection. The valid cartesian area is determined naturally by the projection bounds or by an artificial introduced boundary limit because some cartesian points are at infinity. The shape of the valid cartesian area is in many cases rectangular or circular although it might be more complex.- Specified by:
inWorldBoundsOnSphere
in interfaceILcdProjection
- Parameters:
aXYPoint
- point to be checked upon.aRadius
- radius of the sphere.- Returns:
true
if valid,false
if invalid.
-
clone
Description copied from interface:ILcdProjection
Makes a deep clone of thisILcdProjection
.- Specified by:
clone
in interfaceILcdProjection
- Overrides:
clone
in classALcdProjection
- Returns:
- deep clone of this
ILcdProjection
.
-
toString
Returns theString
representation of theTLcdGeodetic
projection.- Specified by:
toString
in interfaceILcdProjection
- Overrides:
toString
in classObject
- Returns:
- String representation of this
ILcdProjection
.
-
equals
Description copied from interface:ILcdProjection
Checks if thisILcdProjection
equals some other Object.- Specified by:
equals
in interfaceILcdProjection
- Overrides:
equals
in classObject
- Parameters:
aProjection
- Object to compare with.- Returns:
- true if the Object is an instance of the same
ILcdProjection
class and having the same projection properties, false otherwise.
-
hashCode
public int hashCode()
-