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
fPropertyChangeDispatcherFields inherited from interface com.luciad.projection.ILcdProjection
EPSILON -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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.booleanChecks if thisILcdProjectionequals some other Object.Origin of the projection is theILcd2DEditablePointthat corresponds with origin (0, 0) of the cartesian coordinate system of the projection.doubleReturns the scale factor along the X-axis.doubleReturns the scale factor along the Y-axis.inthashCode()booleaninLonLatBounds(ILcdPoint aLLP) Checks if anILcd2DEditablePointis inside the valid area of the transformation of the projection.booleaninWorldBoundsOnSphere(ILcdPoint aXYPoint, double aRadius) Checks if aILcdPointis inside the valid cartesian area of the projection.booleanIf all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjectionand all (x,y ) coordinates are bounded this istrue.booleanAnILcdProjectionis continuous if there are no interruptions in the world coordinates.voidloadProperties(String aPrefix, Properties aProperty) Loads the two properties of this geodetic projection, i.e., the scale factors along the two axes.voidlonlatheight2worldOnSphereSFCT(ILcdPoint aLLP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) Transforms anILcd2DEditablePointon a sphere into the cartesian coordinate system of the projection.voidsetScaleFactorX(double aXFactor) Sets the scale factor along the X-axis.voidsetScaleFactorY(double aYFactor) Sets the scale factor along the Y-axis.toString()Returns theStringrepresentation of theTLcdGeodeticprojection.voidworld2DEditableBoundsOnSphereSFCT(double aRadius, ILcd2DEditableBounds aWorldBound) Sets theILcd2DEditableBoundsobject to the bounds of the projection in world coordinates.voidworld2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPSFCT) Transforms anILcdPointfrom the cartesian coordinate system of the projection into anILcd2DEditablePointonto a sphere.voidwritePropertiesSFCT(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:ILcdProjectionOrigin of the projection is theILcd2DEditablePointthat corresponds with origin (0, 0) of the cartesian coordinate system of the projection.- Specified by:
getOriginin 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:
loadPropertiesin 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:
writePropertiesSFCTin 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:ILcdProjectionTransforms anILcd2DEditablePointon a sphere into the cartesian coordinate system of the projection.- Specified by:
lonlatheight2worldOnSphereSFCTin interfaceILcdProjection- Parameters:
aLLP- point to be projected.aRadius- radius of the sphere (meters).aXYPointSFCT- projected point as side effect.- Throws:
TLcdOutOfBoundsException- If theILcdPointaLLHPis 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:ILcdProjectionTransforms anILcdPointfrom the cartesian coordinate system of the projection into anILcd2DEditablePointonto a sphere.- Specified by:
world2lonlatOnSphereSFCTin 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 theILcdPointaXYPointis not within the valid area of the projection (visible area), then this exception is thrown.
-
isAllInBounds
public boolean isAllInBounds()Description copied from interface:ILcdProjectionIf all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjectionand all (x,y ) coordinates are bounded this istrue. AllILcdProjectionobjects have bounded (x,y ) coordinates because the projection is cut off if necessary.- Specified by:
isAllInBoundsin interfaceILcdProjection- Returns:
trueif all LonLatPoints are within the bounds of the projection,falseotherwise.
-
isContinuous
public boolean isContinuous()Description copied from interface:ILcdProjectionAnILcdProjectionis continuous if there are no interruptions in the world coordinates. Most projections are continuous.- Specified by:
isContinuousin interfaceILcdProjection- Returns:
trueif the projection is continuous,falseotherwise.
-
inLonLatBounds
Checks if anILcd2DEditablePointis inside the valid area of the transformation of the projection.- Specified by:
inLonLatBoundsin interfaceILcdProjection- Parameters:
aLLP-ILcd2DEditablePointto be checked upon.- Returns:
trueif valid,falseif 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:
boundaryLonsin interfaceILcdProjection- Overrides:
boundaryLonsin 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:
boundaryLatsin interfaceILcdProjection- Overrides:
boundaryLatsin 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:ILcdProjectionSets theILcd2DEditableBoundsobject to the bounds of the projection in world coordinates.- Specified by:
world2DEditableBoundsOnSphereSFCTin interfaceILcdProjection- Parameters:
aRadius- radius of the sphere.aWorldBound- the bounds of the projection in world coordinates as side effect.
-
inWorldBoundsOnSphere
Description copied from interface:ILcdProjectionChecks if aILcdPointis 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:
inWorldBoundsOnSpherein interfaceILcdProjection- Parameters:
aXYPoint- point to be checked upon.aRadius- radius of the sphere.- Returns:
trueif valid,falseif invalid.
-
clone
Description copied from interface:ILcdProjectionMakes a deep clone of thisILcdProjection.- Specified by:
clonein interfaceILcdProjection- Overrides:
clonein classALcdProjection- Returns:
- deep clone of this
ILcdProjection.
-
toString
Returns theStringrepresentation of theTLcdGeodeticprojection.- Specified by:
toStringin interfaceILcdProjection- Overrides:
toStringin classObject- Returns:
- String representation of this
ILcdProjection.
-
equals
Description copied from interface:ILcdProjectionChecks if thisILcdProjectionequals some other Object.- Specified by:
equalsin interfaceILcdProjection- Overrides:
equalsin classObject- Parameters:
aProjection- Object to compare with.- Returns:
- true if the Object is an instance of the same
ILcdProjectionclass and having the same projection properties, false otherwise.
-
hashCode
public int hashCode()
-