/** * Same as {@link LatLonGeo#displacedBy(double, double, Datum)}, only * the default datum is used instead of a user-supplied datum. * * @see{@link LatLonGeo#defaultDatum} */ public LatLonGeo displacedBy( double dist, double azimuth ) { return displacedBy( dist, azimuth, defaultDatum ); }
@Override public LatLonGeo unproject( double x, double y ) { return LatLonGeo.fromDeg( y, x ); }
/** * Returns a newly constructed <code>LatLonGeo</code> with a * new altitude but same latitude and same longitude as the current * <code>LatLonGeo</code>. * * @param altitude altitude of the newly constructed <code>LatLonGeo</code> */ public LatLonGeo withAltitude( double altitude ) { return new LatLonGeo( getLatRad( ), getLonRad( ), altitude, true ); }
LatLonGeo centerLatLon = LatLonGeo.fromDeg( centerPosition.latitude.getDegrees( ), centerPosition.longitude.getDegrees( ) ); LatLonGeo swLatLon = centerLatLon.displacedBy( Length.fromMeters( viewportSizeMeters ), Azimuth.southwest ); LatLonGeo seLatLon = centerLatLon.displacedBy( Length.fromMeters( viewportSizeMeters ), Azimuth.southeast ); LatLonGeo nwLatLon = centerLatLon.displacedBy( Length.fromMeters( viewportSizeMeters ), Azimuth.northwest ); LatLonGeo neLatLon = centerLatLon.displacedBy( Length.fromMeters( viewportSizeMeters ), Azimuth.northeast ); Position swPos = Position.fromDegrees( swLatLon.getLatDeg( ), swLatLon.getLonDeg( ) ); Position sePos = Position.fromDegrees( seLatLon.getLatDeg( ), seLatLon.getLonDeg( ) ); Position nwPos = Position.fromDegrees( nwLatLon.getLatDeg( ), nwLatLon.getLonDeg( ) ); Position nePos = Position.fromDegrees( neLatLon.getLatDeg( ), neLatLon.getLonDeg( ) );
/** * Projects a geodetic latitude onto a geocentric latitude * using a ray through the center of the spheroid. See * {@link SpheroidUtil#geodeticToGeocentric(double, double)}. */ public LatLonGeo toGeocentricLatitude( LatLonGeo llg ) { final double latRad = llg.getLatRad( ); final double lonRad = llg.getLonRad( ); final double newLatRad = SpheroidUtil.geodeticToGeocentric( latRad, eccentricitySquared ); return LatLonGeo.fromRad( newLatRad, lonRad, llg.getAltitude( ) ); }
LatLonGeo sw = geoProj.unproject( minX, minY ); double east = ne.getLonDeg( ); double west = sw.getLonDeg( ); double lonSizeDeg = ( east - west ) / xTileDim; Vector2d maxVec = geoProj.project( LatLonGeo.fromDeg( center.getLatDeg( ) + dLat, center.getLonDeg( ) + dLon ) ); Vector2d minVec = geoProj.project( LatLonGeo.fromDeg( center.getLatDeg( ) - dLat, center.getLonDeg( ) - dLon ) );
/** * Computes the ECEF-r representation of the given (east,north,up) * vector given the underlying projection plane's point of tangency. * * @param enuPoint (east,north,up) coordinates of point to be converted, in system units * @param refPoint local tangent plane point of tangency * @return ECEF-r representation of the input (east,north,up) point */ public LatLonRect fromEnu( Vector3d enuPoint, LatLonGeo refPoint ) { final double e = enuPoint.getX( ); final double n = enuPoint.getY( ); final double u = enuPoint.getZ( ); final double sinLat = Math.sin( refPoint.getLatRad( ) ); final double cosLat = Math.cos( refPoint.getLatRad( ) ); final double sinLon = Math.sin( refPoint.getLonRad( ) ); final double cosLon = Math.cos( refPoint.getLonRad( ) ); final double dx = -sinLon * e - cosLon * sinLat * n + cosLon * cosLat * u; final double dy = cosLon * e - sinLon * sinLat * n + sinLon * cosLat * u; final double dz = 0 * e + cosLat * n + sinLat * u; LatLonRect refPointRect = refPoint.toLatLonRect( this ); return LatLonRect.fromXyz( refPointRect.getX( ) + dx, refPointRect.getY( ) + dy, refPointRect.getZ( ) + dz ); }
/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. Altitude * will default to 0. * * @param northLat north latitude in degrees of the newly constructed <code>LatLonGeo</code> * @param eastLon east longitude in degrees of the newly constructed <code>LatLonGeo</code> */ public static LatLonGeo fromDeg( double northLat, double eastLon ) { return new LatLonGeo( northLat * piOver180, eastLon * piOver180, 0d, true ); }
@Override public LatLonRect toLatLonRect( LatLonGeo from ) { return toLatLonRect( from.getLatRad( ), from.getLonRad( ), from.getAltitude( ) ); }
public LatLonGeo greatCircleShift( DatumSphere sphere, LatLonGeo from, double distance, double azimuth_SU, double[] temp2 ) { this.greatCircleShift( from.getLatRad( ), from.getLonRad( ), distance / sphere.getRadius( ), Azimuth.toNavRad( azimuth_SU ), temp2 ); return LatLonGeo.fromRad( temp2[ 0 ], temp2[ 1 ] ); }
final double ESQ = datum.getEccentricitySquared( ); final double P1 = from.getLatRad( ); final double E1 = from.getLonRad( ); final double P2 = to.getLatRad( ); double E2 = to.getLonRad( ); S = Math.abs( meridionalDistance( datum, from.getLatRad( ), to.getLatRad( ) ) ); final double DLON = LatLonGeo.normalizeLon( E2 - E1 ); double SS = Math.abs( DLON ); double ALIMIT = pi * ( 1 - F );
/** * Creates an (east,north,up) representation of this point on the plane * tangent to Earth at the given reference point. * See {@link Datum#toEnu(LatLonRect, LatLonGeo)}. */ public final Vector3d toEnu( LatLonGeo refPoint, Datum datum ) { LatLonRect thisRect = toLatLonRect( datum ); return datum.toEnu( thisRect, refPoint ); }
public String format( String componentFormat ) { return formatDeg( componentFormat ); }
@Override public String toString( ) { StringBuffer sb = new StringBuffer( ); sb.append( String.format( "TP[LatLon(%s)", getRefLatLon( ).format( "%.4f" ) ) ); if ( !_tangentPointOnPlane.equals( defaultTangentPointOnPlane ) ) { sb.append( String.format( ", %s", _tangentPointOnPlane.format( "%.3f" ) ) ); } sb.append( "]" ); return sb.toString( ); } }
/** * Projects a geocentric latitude onto a geodetic latitude * using a ray through the center of the sphere. See * {@link SpheroidUtil#geocentricToGeodetic(double, double)}. */ public LatLonGeo toGeodeticLatitude( LatLonGeo llg ) { final double latRad = llg.getLatRad( ); final double lonRad = llg.getLonRad( ); final double newLatRad = SpheroidUtil.geocentricToGeodetic( latRad, eccentricitySquared ); return LatLonGeo.fromRad( newLatRad, lonRad, llg.getAltitude( ) ); }
/** * Computes the great circle distance between the specified points using the * Haversine formula. */ public static double greatCircleDistance( LatLonGeo from, LatLonGeo to, double radius ) { return greatCircleDistance( from.getLatRad( ), from.getLonRad( ), to.getLatRad( ), to.getLonRad( ), radius ); }