public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }
public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }
public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }